EEPROM bug?

I'm using 0007 on Linux but downloaded the EEPROM library from 0008 Windows.

Very simple program the guts of which are here:

digitalWrite(ledPin,HIGH);
EEPROM.write(0,1);
delay(1000);
digitalWrite(ledPin,LOW);
delay(1000);

(had to manually retype this, so assume any syntax errors are just me)

Just setting the location 0 to a 1, meanwhile running a heartbeat LED on pin 13 so I can keep track. Pin 13 goes HIGH but never goes LOW. If I instead write a 0 to location 0, the hearbeat continues indefinitely. A 5 also hangs. On the off chance it was some kind of size issue, I tried casting to a byte: still hangs. Writing to location 1 also hangs.

?

I've been looking at the code in svn. It looks like for the ATmega168 the eeprom code was handcrafted (avr-libc doesn't support it). It anyone else with this chip using the EEPROM code successfully? It would be hard to see how my end could be messed up with only a single function call....

Weird. Can you post your whole sketch?

Is it possible you're using the Wiring EEPROM library? That one's coded slightly differently, and may only work with the ATmega128 used on that board. The Arduino version is here: http://svn.berlios.de/wsvn/arduino/trunk/targets/libraries/EEPROM/?rev=0&sc=0.

Whole sketch:

#include <EEPROM.h>

int ledPin = 13;

void setup() {
   pinMode(ledPin,OUTPUT);
}

void loop() {
   digitalWrite(ledPin,HIGH);
   EEPROM.write(0,1);
   delay(1000);
   digitalWrite(ledPin,LOW);
   delay(1000);
}

(Once again, I had to retype this so simple syntax errors aren’t in the original, which compiles fine.)

I got the EEPROM stuff out of the windows 0008 download, in the /lib/targets/libraries/EEPROM directory.

All this said, I realized today that I may not strictly require EEPROM for my application, since I might not need to turn it off. But even if I do work around it, I don’t mind being the guinea pig for a debugging session.

It seems to work fine for me (when I copy the 0008 library into my 0007 libraries directory). Which Arduino board are you using? Try deleting the EEPROM.o file and then recompiling your sketch.

It's an NG. The first time around, I had to compile once as root for permissions. Thinking that might be a problem, I chmod'd my arduino dir so I could compile it as myself. The posted test seems to work now, so I don't know if that was it or what.

Hej,

I was having the same issue with the EEPROM library. It worked absolutely fine on my ATmega8 chips and not at all when I used it with a ATmega168 and Arduino008.

With a brand new Arduino 009 it works like a charm.

Cheers Milena