voelker 10 Posted December 4, 2011 Share Posted December 4, 2011 Hi, i have a lot of trouble to get the I2C in the USCIB0 to work. With the modified example provided in slaa382 i have nothing on the bus and my programm stop responding ... I am thinking of moving to a software i2c routine. Thanks for your help Quote Link to post Share on other sites
cubeberg 540 Posted December 5, 2011 Share Posted December 5, 2011 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. Quote Link to post Share on other sites
voelker 10 Posted December 5, 2011 Author Share Posted December 5, 2011 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. Quote Link to post Share on other sites
cubeberg 540 Posted December 5, 2011 Share Posted December 5, 2011 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. Quote Link to post Share on other sites
voelker 10 Posted December 7, 2011 Author Share Posted December 7, 2011 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 ... Quote Link to post Share on other sites
gwdeveloper 275 Posted December 7, 2011 Share Posted December 7, 2011 Hello Voelker, you could take a look at an I2C project I've posted before. http://www.43oh.com/forum/viewtopic.php?f=8&t=1379&hilit=bmp085 I2C, generally, works very well on the G2553. Along with the pullups, make sure you've removed the jumper for the LED on P1.6. Quote Link to post Share on other sites
cde 334 Posted December 7, 2011 Share Posted December 7, 2011 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? Quote Link to post Share on other sites
voelker 10 Posted December 7, 2011 Author Share Posted December 7, 2011 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. Quote Link to post Share on other sites
voelker 10 Posted December 8, 2011 Author Share Posted December 8, 2011 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 ... Quote Link to post Share on other sites
gwdeveloper 275 Posted December 8, 2011 Share Posted December 8, 2011 The i2c project I posted for the BMP085 does wake up from each ISR. The full project was done in the CCS Grace GUI. Can you post your code? Quote Link to post Share on other sites
voelker 10 Posted December 9, 2011 Author Share Posted December 9, 2011 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. bluehash 1 Quote Link to post Share on other sites
bluehash 1,581 Posted December 9, 2011 Share Posted December 9, 2011 Well good for you... feels awesome right? Keep us updated with whatever you are upto and thanks for updating us. Quote Link to post Share on other sites
voelker 10 Posted December 9, 2011 Author Share Posted December 9, 2011 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. Quote Link to post Share on other sites
voelker 10 Posted December 13, 2011 Author Share Posted December 13, 2011 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 ? Quote Link to post Share on other sites
simpleavr 399 Posted December 13, 2011 Share Posted December 13, 2011 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.