Using flash to store variables
Using flash to store variables
Is there any routines that would allow me to stream variable to flash memory on the MOD5272 so that I can persist them? The number of bytes I would need would be well under 64K making EFFS and the physical implementation of a MMC card on my hardware overkill.
Re: Using flash to store variables
Look up SaveUserParameters and GetUserParameters in the NNDK User's manual. By default you can store a maximum of 8K of data. I remember reading something in the Yahoo forums a long time ago about increasing this size if required. If you need more than 8K do a search on the Yahoo forum and you will find info on doing this.
Cheers,
Tony
Cheers,
Tony
- Chris Ruff
- Posts: 222
- Joined: Thu Apr 24, 2008 4:09 pm
- Location: topsail island, nc
- Contact:
Re: Using flash to store variables
I answered this (2 yrs. Ago?) on the Yahoo forum. You can easily use the flash segments at the top of flash for storing any size variable/structs. The segments are 64k and when a given segment is filled up you move to the next one. When you want to change a variable you have to copy the entire 64k into RAM, clear (erase) the segment, make the change in RAM and write the whole thing back. Obviously, this works best for caching values in a serial fashion, and you can only do it some 10000 (100000?) times before you lose bits in the flash for good.
Chris
Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
Re: Using flash to store variables
Look at the technical document on the Netburner Web site
http://www.netburner.com/support/techni ... ments.html
5272 5282 "How to increase User Flash Storage"
Gavin
http://www.netburner.com/support/techni ... ments.html
5272 5282 "How to increase User Flash Storage"
Gavin
Gavin Murray
Re: Using flash to store variables
Kinda related, I was looking at the "How to increase User Flash Storage" but I run into a problem when I call the FlashErase, or FlashProgram, the board freezes and I have to reset.
I want to store various structs in memory and be able to get to them, optimally if I could just pass a memory address specifically it would be a lot easier.
Where in the docs does it describe FlashErase and FlashProgram, I'd like to see how they are implemented and maybe tweake em for my needs.
Right now I'm just using the SaveUserParameters and passing a (ever growing) struct.
I want to store various structs in memory and be able to get to them, optimally if I could just pass a memory address specifically it would be a lot easier.
Where in the docs does it describe FlashErase and FlashProgram, I'd like to see how they are implemented and maybe tweake em for my needs.
Right now I'm just using the SaveUserParameters and passing a (ever growing) struct.
Re: Using flash to store variables
I believe that NB has an application note on how to increase the size of the user configuration space above 8kb. It involves making a change to a link file. I believe that the primary reason you need to do this is to ensure that however much larger you make it that there isn't a conflict with over-writting the application stored in FLASH. I've done this before (increased it to 32kb). Just don't remember the details.
bb
bb
Re: Using flash to store variables
What I was thinking was using the 8k user parameters, as my parameters are like 10 bytes or so. The idea say I have a struct of running user parameters I want to save, and default "factory reset" parameters I want to save.
Problem is the SaveUserParmeters don't allow you to specify a start address (unless it's overloaded) and thats what I need. Something like
then save a new set of user parameters to the new pconf address, which is right after the first parameters address.
I know the addressing is working just no way to save that I've found.
It just would be easier to save stuff to either a hard passed address value, or whathave you.
Problem is the SaveUserParmeters don't allow you to specify a start address (unless it's overloaded) and thats what I need. Something like
Code: Select all
userData* pconf = (userData *) GetUserParameters();
pconf++;
I know the addressing is working just no way to save that I've found.
It just would be easier to save stuff to either a hard passed address value, or whathave you.