Go Down

Topic: Internal EEPROM cause arduino to freeze (Read 5158 times) previous topic - next topic

inode

Hi everybody,

I running into a strange problem with internal eprom with an arduino Nano (I got only this version). From the Arduino datasheet http://arduino.cc/en/Main/ArduinoBoardNano I can see that a 1KB eprom is avaible.

When I try to write the full eprom the arduino seem to freeze.

Code: [Select]
for(int i=0;i<1024;i++) EEPROM.write(i,0);

When I use a value much smaller (like write only 600 bytes) it work fine.

In the same code I'm also using also the F("") macro (http://playground.arduino.cc/Learning/Memory), but seem that the string should be memorized into the flash memory and not the eprom.

Any idea of what can be?

thank you in advance.

inode

pito

#1
Sep 25, 2013, 06:07 pm Last Edit: Sep 25, 2013, 06:10 pm by pito Reason: 1
Show us your sketch.
PS: Arduino nano 2.x has got only 512b eeprom.

CrossRoads

512 bytes in a '168, 1024 bytes in a '328P.
Even so, writing past 512 in a 168 would only wraparound and restart at 0.

Each byte takes 3.3mS, so 1024 bytes = ~3.3792 seconds.
Even so, odd for the code to totally freeze.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

inode

I did some more test, on an empty sketch the code is working fine and I can access to all 1024 bytes... unfortunately I cannot post my code here.

It's possible that EEPROM.write will get trouble inside a routine called by an Interrupt? I saw that serial line got problems on this case, but no mention to EEPROM stuff.

Regards.

inode

PaulS

Quote
It's possible that EEPROM.write will get trouble inside a routine called by an Interrupt? I saw that serial line got problems on this case, but no mention to EEPROM stuff.

How long did CrossRoads say that the loop would take to execute? Now, is it anywhere near reasonable for an interrupt to take that long?

I didn't think so.

CrossRoads

If you can't post, because your sketch is too long, click Additional Options below and Attach your sketch.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

inode

I don't know but the code work correcly outside the interrupt call. I will check again inside a interrupt when I have some free time...

Thank everybody.

inode

Elektrix

Perhaps you are running out of RAM? Try to hold all stable values like output strings for a display in the flash-ROM. Instead of
Code: [Select]
println("Hello World");type
Code: [Select]
println(F("Hello World")); This will save you some space in the RAM. The problem is that the arduino IDE doesn't tell you about RAM problems. But this can occur the more complex your sketch is.

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

Go Up