SAM E5x/D5x - Issues with NVM User Page

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

Hi all,

 

I am using the SAME51J20A and trying to utilize the extra 480 bytes of memory in the NVM User Page.. However, the FLASH module included via Atmel Start/ASF only seems to be able to write/read within the "Program Space" of memory.. Within the HAL, I get a BAD ADDRESS error because the address I pass in for the NVM User Page (0x00804000) is outside of the "allowed" range, which is the Page Size * Number of Pages (512 x 2048)..

 

Is there another module within ASF that can be used for reading/writing to the User Page.. Or do I need to just go about this manually without the HAL?

 

Thanks in advance for the assistance.

 

// I'm also open to other suggestions if the NVM User page really isn't the best thing to use.. I just need a handful of bytes to write to, so I can store my app configuration through a power cycle..

This topic has a solution.

murph

Debugging - Being a detective in a crime movie where you are also the murderer.

Last Edited: Tue. Nov 6, 2018 - 12:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just use the highest addressable block, for instance.  I'd *prefer* to use the user block, but given your experience so far, I am glad I did it this way...

jeff

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

Hmm, that seems fine. I don't ever expect to fill the full 1M of Flash.. Any data you write there would be wiped when flashing the target though.. Right?

 

Did you modify the memory length within the sameXXXX_flash.id so the last page was not allocated to rom?

 

It would be preferred that I could re-flash multiple times and not lose any data written.

murph

Debugging - Being a detective in a crime movie where you are also the murderer.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well.. I didn't really find a solution to my initial problem.. but I did find an alternate solution.

 

I am just going to use the last page of data in Flash as Jeff suggested. I also found the option to only erase the program area as needed based on the compiled app. I did a little test where I wrote test data to the last page of Flash, and then flashed the chip with another set of code which reads out the last page, and verified that all of the test data persisted through the re-flashing

 

The "Erase only program area" can be found here: Project -> ProjectName Properties -> Tool -> Programming Settings

 

// I also found that changing the length of the ROM with the .id file had no effect on the programming/erasing. (I thought maybe if I defined ROM as 0x00 to 0xFFE00, it would only erase that range, but this was not the case.. It still erased the full 1Mb).. So I will be leaving the length of ROM to 0x100000 until I need to add a bootloader..

murph

Debugging - Being a detective in a crime movie where you are also the murderer.

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

in the project settings for the tool, do not erase all memory, as you just talked to yourself about :).

You SHOULD modify memory size - on my to learn list

 

somewhere behind remembering which project I am working on and learning how to load critical code to TCM cache...

jeff