Page 1 of 1

Using flash to store variables

Posted: Sat Aug 09, 2008 11:51 am
by jkovach
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

Posted: Sat Aug 09, 2008 3:11 pm
by tony
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

Re: Using flash to store variables

Posted: Sat Aug 09, 2008 6:01 pm
by Chris Ruff
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

Re: Using flash to store variables

Posted: Sun Aug 10, 2008 11:25 pm
by gavinm
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

Re: Using flash to store variables

Posted: Wed Nov 05, 2008 11:14 am
by ccoleman
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.

Re: Using flash to store variables

Posted: Wed Nov 05, 2008 11:35 am
by bbracken
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

Re: Using flash to store variables

Posted: Wed Nov 05, 2008 12:04 pm
by ccoleman
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

Code: Select all

userData* pconf = (userData *) GetUserParameters();
pconf++;
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.