2011-09-10 02:17 AM
Hi,
When I read from EEPROM multiple times, it succeeds to read for the first time but then it fails always even if I reload the project. To solve this issue I have to power off the board (unplug the USB cable). When I debug it I found that the EEPROM entered a BUSY STATE and it never goes out of it unless you power it off. I have 2 questions: 1) what is the right way to read from EEPROM without getting a BUSY? 2) when a BUSY occurs, how to revert to idle state without power off? Regards, Celo2011-09-10 04:40 AM
Can you be more specific about the EEPROM part you are using, one internal to one of the STM32L parts, or and external one? If external is it SPI or I2C? Remember all anyone here knows about your project is provided in your post.
2011-09-10 05:57 AM
1) what is the right way to read from EEPROM without getting a BUSY?
To follow the EEPROM specs regarding the transmission rate (<100kHz or <400kHz) and to complete the I2C transactions (START-actions-STOP) even while debugging the code. As well known, I2C of STM32Fx is miserable designed and thus tricky to control; so watch if you process all the I2C events properly providing the required I2C state sequencies to your EEPROM.
2) when a BUSY occurs, how to revert to idle state without power off?
Take control over SCL as GPIO and generate by software at least 11 pulses (1-0-1) on it (but not faster than EEPROM I2C specs, i.e. < 100kHz or < 400kHz). Good luck!2011-09-10 12:49 PM
Can you be more specific about the EEPROM part you are using, one internal to one of the STM32L parts, or and external one? If external is it SPI or I2C? Remember all anyone here knows about your project is provided in your post.
sorry... weakness in Embedded World. EEPROM: M24M01 - external - I2C1) what is the right way to read from EEPROM without getting a BUSY?
To follow the EEPROM specs regarding the transmission rate (<100kHz or <400kHz) and to complete the I2C transactions (START-actions-STOP) even while debugging the code. As well known, I2C of STM32Fx is miserable designed and thus tricky to control; so watch if you process all the I2C events properly providing the required I2C state sequencies to your EEPROM.
Transactions are completed; i.e (START - ACTIONS - STOP) I'll check the events.2) when a BUSY occurs, how to revert to idle state without power off?
Take control over SCL as GPIO and generate by software at least 11 pulses (1-0-1) on it (but not faster than EEPROM I2C specs, i.e. < 100kHz or < 400kHz).
Good luck! I'll keep you updated. ---------------------------------------------------------------------------- Thank you all for responding.2011-09-11 05:42 AM
Sometimes when you incorrectly address an I2C slave it will hold onto the SDA line after the stop bit is sent. so when you next try to address it the stm32 will get stuck in its wait states.
So what ColdWeather says is correct , generate a series of clocks when you first initiate to be sure that you have cleared the slave and it releases the SDA line.Darren.