2009-03-11 08:20 PM
I2C with Keil RTX doesn't work
2011-05-17 04:06 AM
Hi
When I use I2C library without Keil RTX to communicate with I2C EEPROM the program works fine, but when I start the RTX the program stuck at:Code:
while(!Status) Status=I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED); // Test on EV6 and clear it Somebody know how to fix this? Ps: uVision3 V3.63 , MDK-ARM V3.24 , RL-ARM V3.402011-05-17 04:06 AM
Hi,
did you try already this sample? You can learn from this sample, how it should work. I am/was also struggling on the same problem/item. ...ST\STM32F10xFWLib\Examples\I2C\M24C08_EEPROM I am using the M24C256 and it works so fare fine for me. Greets, K.2011-05-17 04:06 AM
Hi Fellow Programmers:
I had a similar problem with I2C. Most difficulties are created by using the ''Event'' matches, where all bits have to match. Sometimes you have to make your own functions, or work directly with the registers. I used a breakpoint to see what status was being reported, and I found that the RX buffer was not cleared, so, in order to clear the buffer, I made a function call to ''I2C_ReceiveData'' before initiating any send operation, and this fixed that problem. Of course, there were other problems too. In general, the I2C is very difficult to get it working correctly. You may need to spend a lot of time understanding the limitations of ''Example 5'' and making it work reliably. Just when you think you have got it, try removing the I2C device during communications, then try to get the I2C code to re-organize itself and get started again. In my case, I wasted two weeks getting I2C to operate semi-reliably, however, about one in a hundred times, it will hang-up when the I2C device is pulled during communication. I recommend you search the Forum for some earlier articles about I2C. You will find many articles, and a lengthy discussion about the problem associated with receiving one byte more than expected because of the difficulty in getting the STM32 I2C Peripheral to send the STOP condition for the last byte to end correctly. After reading all these discussions myself, and doing extensive testing, I found it easier to just let the last byte be received into an extra byte in the array, then subsequently ignore that byte. Anyway, best wishes in your sleuthing. Garry. [ This message was edited by: design6 on 12-03-2009 00:09 ]2011-05-17 04:06 AM
Few months ago I was trying to handle EEPROM over I2C. I've used DMA for sending one page of data to the EEPROM chipset. It solves all my problems. Later ST put this recommendation into the ERRATA sheet.