Other Parts Discussed in Thread: MSP430G2553
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: MSP430G2553
raj gokhale said:Hey guys please tell me why the start and stop bits are not clearing.....
That's not the way to elicit help. Since the people who help answer questions here are (generally) not TI employees, and we do this out of the goodness of our heart in our own spare time.....
1. Tell us what steps you have taken to debug the problem yourself. What have you tried changing? What exactly are the conditions that cause your issue, etc?
2. Your code is long, not indented, and hard to read. Try attaching the file, not copy-pasting into this forum edit box that doesn't understand tabs.
Generally, you want to make it easier for someone to help you, and to not appear demanding an answer. It's forum etiquette.
It can have several reasons, external and internal ones.
Your ISR doesn't check for a NACK (in case the slave doesn't answer). It is called imemdiately (in TX mode) after setting TXSTT, writes the first byte to TXBUF, and then might be never called again when the slave doesn't answer. And main remains dormant.
Also, it is a very bad idea to do any busy-waiting inside the ISR. As you do when waiting for TXIFG. You should just restructure your output count logic and exit LPM on the next interrupt. You can even move setting TXSTP into the ISR then.
Besides this, it is a bit unclear what your problem is. What doesn't clear when and where and how do you check for it? Apparently, STT and STP can't both not clear as your code won't set STP unless three bytes have been sent (whcih means that STT is long cleared).
thanks Jens-Michael Gross
my problem is the condition while (UCB0CTL1 & UCTXSTP); is not occurring .if i comment this code then the program executes well and also load the txbuf with low addr,high addr, and data to be written on that address.but for getting this this data back to comntroller it is not showing the proper data from the address given .
and i have to set the USCIB0RXFG flag manually unless it wont go in the rx isr as it not setting automatically.there is no prblem with txifg flag.
my question is how could i know that data is been actually written to that eeprom memory location
the code used by me is with reference from the ti sample code for interfacing a msp430 to eeprom.
the url is as folllows
http://www.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=slaa208a&docCategoryId=1&familyId=342
in my hardware i am using 10K pullups on SDA and SCL lines and operating SCL at ~100k
YOu mean, you set UCTXSTP and it never clears?raj gokhale said:my problem is the condition while (UCB0CTL1 & UCTXSTP); is not occurring
In receive mdoe, there is one condition where this may occur: when you set UCTXSTP while there is already a byte in RXBUF and receiving of th enext byte has begun. Then the bus will stall on teh 7th bit of the next byte until you read RXBUF. And since the bus is stalled, the stop condition isn't sent. You need to read RXBUF first.
What I noticed, after calling I2CInit, you wait for the flash to write data. What data= You haven't written anything yet. Shouldn't you wait (or rahter poll the chip) after you wrote something?
Also, you don't need to set UCTXIFG. It is automatically set in transmit mode when you set UCTXSTT.
hmmmm, that's strange. You mean RXIFG doesn't get set?raj gokhale said:and i have to set the USCIB0RXFG flag manually unless it wont go in the rx isr as it not setting automatically
However, the code seems to set UCTXSTP as soon as UCTXSTT clears, which is actually before receiving of the first byte has started, so UCB0RXIFG will never be set.
Alsom in your reandom read funciton, you fill the address to I2Cframe[0]and [1] rather than [1] and [2]. [0] is never sent in your TX ISR, so you're only sending one address byte. The eeprom possibly doesn't like this. (well, the way you handle your send buffer and the index into it is a bit strange and confusing anyway, apparently for you too)
hi jens -michael,
I read ur reply and i am facing same problem as u mentioned that
Jens-Michael Gross said:However, the code seems to set UCTXSTP as soon as UCTXSTT clears, which is actually before receiving of the first byte has started, so UCB0RXIFG will never be set.
Alsom in your reandom read funciton, you fill the address to I2Cframe[0]and [1] rather than [1] and [2]. [0] is never sent in your TX ISR, so you're only sending one address byte. The eeprom possibly doesn't like this. (well, the way you handle your send buffer and the index into it is a bit strange and confusing anyway, apparently for you too)
which is the right way to do that can u guide me.
**Attention** This is a public forum