cancel
Showing results for 
Search instead for 
Did you mean: 

Fail to read from EEPROM

alfaez
Associate II
Posted on September 10, 2011 at 11:17

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,

Celo
4 REPLIES 4
Posted on September 10, 2011 at 13:40

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ColdWeather
Senior
Posted on September 10, 2011 at 14:57

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!

alfaez
Associate II
Posted on September 10, 2011 at 21:49

From: clive1

 

 

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 - I2C

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.

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.
munk2k
Associate II
Posted on September 11, 2011 at 14:42

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.