Jump to content
43oh

I2C on USCI with MSP430G2553


Recommended Posts

Have you tried the 2553 code samples here? The link is on the TI product page (http://www.ti.com/product/msp430g2553#toolssoftware) There are 13 different code samples specific to that chip, including schematics.

 

I haven't tried them myself, but I've had a lot of luck with those samples with the 2553.

Link to post
Share on other sites

Thanks for your answer. It seems that there is a lot of difference with another sample from texas that i'am using (slaa382). The most obvious difference is the configuration of P1SEL and P1SEL2 (my example was only setting P1SEL) ... I should have read the datasheet more deeply.

Thanks again.

Link to post
Share on other sites

I still find all the registers confusing :) I've only been using the LP for a couple of months now. That's why I've found exact examples working on the chip you're targeting are invaluable. I've found TI's datasheets much more confusing than Atmel. You might have trouble with the code if you're not using CCS - but folks around here who use other apps would probably be glad to help out.

Link to post
Share on other sites

I tried the example code and it worked like a charm on first try ... but didn't on the second. I'am connecting to an I2C display, the first time i could configure the display, but now it always fails to get an ACK from the device, i've tried disconnecting everything tested the solder and ... nothing. I have monitored the communication using the bus pirate, and it appears that no ACK come from the device. When i try to control the display through the bus pirate, i can configure the display and i get ack from the device. I'am using 8.2K pull-up (no 10k on hand) but i don't see how it could be the problem ... The other option, is that i manage to burn the IO of the chip and it cannot get the ACK ... I'll keep investigating ...

Link to post
Share on other sites
I tried the example code and it worked like a charm on first try ... but didn't on the second. I'am connecting to an I2C display, the first time i could configure the display, but now it always fails to get an ACK from the device, i've tried disconnecting everything tested the solder and ... nothing. I have monitored the communication using the bus pirate, and it appears that no ACK come from the device. When i try to control the display through the bus pirate, i can configure the display and i get ack from the device. I'am using 8.2K pull-up (no 10k on hand) but i don't see how it could be the problem ... The other option, is that i manage to burn the IO of the chip and it cannot get the ACK ... I'll keep investigating ...

 

Which i2c display, and what speed are you running the i2c on the msp430?

Link to post
Share on other sites

The display use a ST7032 controller, and i run the I2C at 100khz with 8.2k pull-ups (no 10k available). After sending one byte, the MSP430 does not generate an interrupt and hold the SCL line to ground (like if its waiting for a ACK).The problem is that it worked once and never again ... I'am sure the problem does not come from a soler because i can the byte coming out when spying with a bus pirate. Using the same bus pirate i'am able to communicate with the display (the display is not burnt) ... I'am struggling with that problem and i need to find an answer quick as it is for a christmas present.

Link to post
Share on other sites

I tried again to get my code to work, and it sometimes work ... but not always. Testing the simple i2c sample from texas works now (i sometime get nacked by the device), but when instantiated in my full project, it fails.

 

Watching gwdeveloper code there is something i don't understand. The start_RX(void) function puts the processor in LPM0 mode but i just does not see where the processor get waked up. Usually that an interrupt routine clears the CPUOFF bit to allow the programm to run ...

Link to post
Share on other sites

It works ! I don't feel like i understood the problem i had, but i got it working ... My first mistake was with the interrupt generated when a NACK happens. It does not set the flag UCB0RXIFG so you should avoid testing the flag before testing the UNACKIFG flag. The second thing i did was basically moving all my i2c code to the main file (insteadof having a i2c.h and i2c.c). I don't know what i changed while moving the code, but it is now working. I'll post my code soon, just need to clean it a bit.

Link to post
Share on other sites

Everything is working fine now, my custom sprintf routines work well for the display, i parse gps stream, and i can store data to the flash ... seems that i'am ready to submit my project to this month contest. Still need to shoot a video, and draw the schematics.

Thanks for everybody's help.

Link to post
Share on other sites

my usci code becomes unstable when running the device for some time ... but i may have the explanation ! I'am running the msp430g2552 at 16mhz with a 3.0v power supply. The datasheet states that a device running at 16mhz should be powered by 3.3v to 3.6v. Do you think that powering the device at 3.0V can cause some weird behavior when running at 16mhz ?

Link to post
Share on other sites
The datasheet states that a device running at 16mhz should be powered by 3.3v to 3.6v. Do you think that powering the device at 3.0V can cause some weird behavior when running at 16mhz ?

 

u should observe what the datasheet says. i can never go 16Mhz on 3.0v supply reliably. have tried it before. i did not use usci, but timera will act un-predictably and u will get resets. u can run 12Mhz reliably on 2xAAA cells though.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...