EEPROM || Not able to write data from address 0x0020 and above

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello team,

 

I am using an ATxmega32E5 microcontroller. Using the avr/eeprom.h library for writing the data to eeprom memory. 

Currently, I am writing the float values to eeprom memory. I am writing 9 variables in to EEPROM memory. After I run the eeprom_write_float command, I can see the 8 values getting written on the EEPROM memory correctly (in debug mode). 

9th variable is written to the address 0x0020, data written to this address and above, always shows FF FF FF FF in the eeprom memory location. I have pasted screenshot for your reference. 

 

I tried same code on another Atmel chip, it was giving the same issue.

 

I have few doubts, eeprom.h file I am using is  from the following location(\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h), its referring to 8 bit AVR. But I am using the 32 bit microcontroller,  I tried looking for the eeprom library in avr32 folder, but I couldn't find any files referring to eeprom or nvm. I also tried looking into Atmel Start Project, to add eeprom, but I couldn't find the interface being available there. 

 

Could someone please help me regarding this ?

 

Thanks and best regards,

Chetan

 

 

Attachment(s): 

Chetan

Last Edited: Tue. Feb 18, 2020 - 10:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

chetan6491 wrote:
eeprom_write_float
Just a word of advice - never use the _write_ routines. Always use _update_ ones instead (they won't do pointless writes that could wera out the EEPROM)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Clawson,

 

Thanks for the reply.

I tried with the eeprom_update_float() function, but it didn't help. 

 

Best regards,

Chetan

Chetan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Try stepping into the eeprom_write/update_float when it would be accessing 0x20 and see what actually happens

 

Oh and also make sure your device packs are up to date - with "new silicon" it's possible the original support files might have had some errors.

Last Edited: Tue. Feb 18, 2020 - 12:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since you didn't tell us what EEPROM that you are using, you may be using one that has a small page size.  The EEPROM write routine is possibly not updating the address after each write.  The EEPROM will do this automatically, but only inside the current page.  Pages on small density EEPROMs can be 32-64 bytes in size.  The write operation will roll over to the first byte of the page if you try to write beyond the page end (without resending a new EEPROM address).

  Check if the value in address 0 has the value that should be in 0x0020.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
Since you didn't tell us what EEPROM that you are using
Eh? He means the EEPROM built into the 32E5 itself - otherwise why would he be using eeprom_write_float/eeprom_update_float ?!?!?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Guys, 

 

@Clawson: Thanks for the reply and inputs. I'm not able to access eeprom.c file, I have access only to eeprom.h (which I added using #include "avr/eeprom.h"), so I couldn't really see what was happening with an update and write functions. I was able to only see assembly-level changes under the disassembly tab, but I didn't see much difference between both the functions. 

I checked for any update was pending, Atmel was updated fully. 

 

@Simonetta: I am using inbuilt EEPROM which is of 1024 bytes size. So I was within the size limit. Since in the write function it didn't ask anything related to page size, so I didn't think about that.

 

I managed to fix the issue, but I guess the issue was with the library used previously (I was using avr/eeprom.h). I changed to nvm.h library and made few changes in the code for it compile and it worked, I am able to write data to address 0x0020 and higher. 

 

Atmel has really bad documentation when I checked the ATxmega32E5  homepage, it was indicating to use eeprom-driver.h library to write the data to epprom. I also tried to add eeprom-driver.h but it was failing to compile with errors, I couldn't find the solution, so I moved to use nvm.h library. I hope someone from Atmel gives proper documentation related to this, it will be really helpful.

 

Thanks and best regards,

Chetan 

Chetan

Last Edited: Tue. Feb 18, 2020 - 04:27 PM