XMEGA EEMEM

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, 

 

I am trying to move some motors around and store their location in the EEPRROM using the EEMEM functions with my Xmega128a1u. The way I initialize my memory locations is as follows. 

 

uint32_t motor1location EEMEM = 0xffffffff;
uint32_t motor2location EEMEM = 0xffffffff;

 

when I update the location I use. 

 

eeprom_update_dword(&motor1location,motloc1);
eeprom_update_dword(&motor2location,motloc2);

 

 

and then when I try and read back at a later time I use 

 

motloc1 = eeprom_read_dword(&motor1location);
motloc2 = eeprom_read_dword(&motor2location);

 

motloc1 and 2 are volatile uint32_t variables and ge changed throughou the program. I read them out and I know that they have the correct values, but when I read back the values stored, they are always zero. Worse, when I try zeroing the values using 

 

eeprom_update_dword(&motor1location,0x00000000);
eeprom_update_dword(&motor2location,0x00000000);

 

 

the first one is set to an arbitrary large number and the second is still zero. 

 

I had this working for just one motor really nicely and when I added the second it started freaking out. What am I doing wrong? 

 

Josiah