xmega 128A1 eeprom issues

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

Hi,

I'm trying write to xmega eeprom memory mapped, but not successful.

 ldi	Temp, NVM_EEMAPEN_bm; Enable EEPROM Memory Mapping 
 sts 	NVM_CTRLB, Temp

 ldi R16, 0xA0
 ldi R17, 0xA1
 LDI YH, $10 
 LDI YL, $00 
 ST Y+, R16 ; Value 1 in first address
 ST Y, R17  ; value 2 second address
 
NVMBusy0: 
   LDS Temp, NVM_STATUS 
   SBRC Temp, 7 
   RJMP NVMBusy0 
   LDI Temp, $00 
   STS NVM_ADDR0, Temp 
   LDI Temp, NVM_CMD_ERASE_WRITE_EEPROM_PAGE_gc 
   STS NVM_CMD, Temp 
   LDI Temp, $D8 
   STS CPU_CCP, Temp 
   LDI Temp, $01 
   STS NVM_CTRLA, Temp

NVMBusy1: ; wait just for test
   LDS Temp, NVM_STATUS 
   SBRC Temp, 7 
   RJMP NVMBusy1

After that eeprom values not changing ( maybe some bug in simulator ? )

I'm searched a lot last days, but not interesting found.
Can anyone help me? I'm writing in AVR Studio assembler.

Regards
macc

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

Did you test your code only in simulator? Try to do a real test. Also assign $00 to NVM.ADDR1 and NVM.ADDR2.

Ozhan KD
Knowledge is POWER

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

electronic.designer wrote:
Did you test your code only in simulator? Try to do a real test. Also assign $00 to NVM.ADDR1 and NVM.ADDR2.

On hardware works. But not sure it's okay. Maybe it's compiler bug.