Jump to content
43oh

ElectricCowboy

Members
  • Content Count

    9
  • Joined

  • Last visited

Reputation Activity

  1. Like
    ElectricCowboy got a reaction from DDimitrov in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    Hmm, don't see attachment.  I will try again...
    20141210 - TI MSP430 I2C Diagram 8x8 BiColor LED Matrix.pdf
  2. Like
    ElectricCowboy got a reaction from adroit_91 in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    SUCCESS!
    I added 10k-ohm pull-up resistors to the SCL and SDA lines on both sides of the level shifter.
    I updated this thread with code, an updated schematic and a snapshot of my dev board including one test pattern showing Green, Red and Yellow pixels.
    Many thanks to zeke and SvdSinner for their help and replies to this thread.
    For me, this is a nice little accomplishment for a variety of reasons: TI Code Composer Studio, TI MSP430 LaunchPad, reuse of an 8x8 Bi-Color Matrix device, and using I2C (albeit via library APIs).
     
    Onwards! 
     
    I plan to expand this DIY project by adding timers for LED animation, adding additional LED matrices, and possibly employing the LaunchPads other I2C interface.  I would also like to explore the TI RTOS at a later time in 2015.  I would also like to employ switch debouncing and implement different animation modes, and harden the hardware design as suggested.  Perhaps I'll update my progress as progress is made...
     
    Electric Cowboy
    20141212 - TI MSP430 I2C Diagram 8x8 BiColor LED Matrix.pdf

    main.c
  3. Like
    ElectricCowboy got a reaction from zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    SUCCESS!
    I added 10k-ohm pull-up resistors to the SCL and SDA lines on both sides of the level shifter.
    I updated this thread with code, an updated schematic and a snapshot of my dev board including one test pattern showing Green, Red and Yellow pixels.
    Many thanks to zeke and SvdSinner for their help and replies to this thread.
    For me, this is a nice little accomplishment for a variety of reasons: TI Code Composer Studio, TI MSP430 LaunchPad, reuse of an 8x8 Bi-Color Matrix device, and using I2C (albeit via library APIs).
     
    Onwards! 
     
    I plan to expand this DIY project by adding timers for LED animation, adding additional LED matrices, and possibly employing the LaunchPads other I2C interface.  I would also like to explore the TI RTOS at a later time in 2015.  I would also like to employ switch debouncing and implement different animation modes, and harden the hardware design as suggested.  Perhaps I'll update my progress as progress is made...
     
    Electric Cowboy
    20141212 - TI MSP430 I2C Diagram 8x8 BiColor LED Matrix.pdf

    main.c
  4. Like
    ElectricCowboy reacted to SvdSinner in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    Schematic Issues:
    1)  No pull-up resistors.  Start by adding 10k pull-ups to both lines.  (Shouldn't matter which side of the level shifter you add them, but I'd try the 5v side first.)
    2)  No decoupling capacitors.  Add in caps between the 3v & 5v lines and GND.  Otherwise a spike/lull cuased by your LED matrix can cause all sorts of wierd issues.  Better safe than sorry.
    3)  You have no way to reset your slave device.  I'd recommend you use a GPIO with a transistor (high side switch) to allow your program to power-cycle the LED driver.  I haven't used that specific device, but I've seen other I2C devices get stuck holding down the SCL, and if you can't  power cycle it, it will block all I2C communications.  Remember that your slave doesn't reboot each time you restart your program.  Ideally, put the pull-up resisters after the switch, because some devices can function with the juice from the data lines long enough to not reset when you cut their Vcc line.
    4)  Consider adding points on your line to put an I2C sniffer.  (Hopefully, you have access to a logic analyser)  What you don't want is to have your lines getting wiggled every time you hook-up/remove testing tools.  
     
    Suggestions:***
    1)  Make sure everything is held securely while you get it working.  I use a chunk of cardboard and hot glue everything down to it.  You want to make sure nothing unexpected gets pulled out when things get bumped and cords get swapped.
    2)  Don't assume ANYTHING is working like you think it is.  Test your wiring connections for continuity.  Test all four lines with a VMM.  Test any pins/sockets/headers to make sure every pin has good contact. Huge amount of "problems" with I2C are just basic wiring problems.  
    3)  If you are starting from scratch, I'd recommend using the Energia code base and it's port of wire.h for I2C.  The TI I2C libraries are quite buggy (There are function in the driver library that simply don't work on an MSP430F5529 and will hang your program) and have an over-complicated programming model.  I'm currently trying to get wire.h to compile with the TI compiler, because I have some code that uses it 
    4)  Unit test every I2C call you expect to make.  Make a project that atomically does each function so you can prove the basics work before you integrate them into your code.  It is a bit of work, but much less work than trying to debug a program when you don't know which of the components are actually doing what you think they are.
    5)  Document every time things work correctly, preferably with source control.  If/when you break something as you add to the code, you want a clear place to return to if you don't like how your change turned out.
    6)  If you find a loose connector, etc.  Toss it out and use a better one.  Just because you can wiggle it and get it to work again for the moment, doesn't mean you won't spend more time & effort testing and wiggling it than it is worth.  (This advice might be more for me than you.  Can't tell you how many times I've been dumb enough to throw a bad connecter back into my parts bin so that I get to have the same problems again the next time I pull it out.)
     
    ***These suggestions mostly come from experiencing the pain of not using them.  Hope they help.  Troubleshooting I2C can be maddeningly complex if you don't work hard to ensure that your building blocks are solid.
     
  5. Like
    ElectricCowboy reacted to zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    @ElectricCowboy: Your schematic looks good to me. 
     
    I agree with @@SvdSinner that you need to put pullup resistors on the SDA and SCL lines.  But here's the catch, you have to put pullup resistors on both sides of the level translator to make it work.
     
    I agree that 10K pullups will do the job well.
     
    Do you have a logic analyzer? I use a Saleae Logic. It's the cat's meow.
     
    My experience with TI's sample I2C is also negative so I wrote my own Bit Bang I2C Master routines. It ended up looking a lot like the Energia routines but more raw and not at all C++ like.
     
    Don't worry about being perfect. Just enjoy the process of exploration. Ask us lots of questions. We're here to share the adventure.
  6. Like
    ElectricCowboy got a reaction from zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    Hello,
     
    I purchased a 4x bi-directional level-shifter from Adafruit (http://www.adafruit.com/products/757).
    I soldered the header and mounted it and the 8x8 LED Matrix to an experimenter board.
    I created the attached schematic diagram, 20141210 - TI MSP430 I2C Diagram 8x8 BiColor LED Matrix.pdf, to this thread.
    I believe the electrical connections are correct.
    I added blue wires (really, they are blue!).
    I attempted to enable I2C communications in mid-November. 
    Although my software was not correct, I did see that the 8x8 LED Matrix was "alive", because some of the LEDs in the Matrix illuminated; this is certainly a good sign.
    I will continue to try changes to my software and will update the thread soon.  (Full-time job takes precendence over hobbies...)
     
    Is anyone in the community willing to eye-ball and check my attached schematic diagram? Thanks in advance.
     
    Electric Cowboy
  7. Like
    ElectricCowboy reacted to zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    If you want to use I2C then you will want to use:
     
    or you could use P3.0 (UCB0SDA) and P3.1 (USCB0SCL). That other set is for the SPI port. 
     
    Remember to install pull up resistors on the SDA and SCL lines. 
     
    Assuming you are talking to a simple, straightforward I2C slave device, you will want to setup the MSP430 as the I2C Master and command the I2C slave device with its set of commands.
     
    Most of the time, you will get 8 bit data back from the device. Sometimes you will get 16 or 32 bit data back from the slave. In those cases, you will have to read the device two or more times to pull all the data from, then shift and logically AND the bytes together to construct 16 or 32 bit wide samples.
     
    As you have already discovered, there are many code examples from TI that demonstrate the usage of the I2C peripherals. You will have success if you mimic them. 
     
    Tell us more about your external sensor IC. What is the part number?
    What are your intentions? What do you want to accomplish?
     
    Let's see if we can get you talking with your I2C sensor.
  8. Like
    ElectricCowboy reacted to zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    The first thing that I can see is the ht16k33 controller is a 5 volt part. This is a problem because the msp430 is a 3 volt part.
     
    You will have to use a bidirectional level shifter on the SDA and SCL lines to keep the msp430 from having a fit.
     
    Adafruit has 3 to 5 volt level shifter ie: http://www.adafruit.com/products/757
     
    Without the level shifter, your code will think the i2c bus is locked up.
  9. Like
    ElectricCowboy reacted to zeke in Question about I2C, DriverLib and MSP-EXP430F5529LP   
    @ElectricCowboy: You are very welcome! Just tap on the thanks button and let us know how things work out for you. We are definitely interested in what you are doing. You may even need to make us a video of your circuit in action so we can check it out with you!
×
×
  • Create New...