Using flash to store variables

Discussion to talk about hardware related topics only.
Post Reply
jkovach
Posts: 11
Joined: Tue Jul 29, 2008 5:30 pm

Using flash to store variables

Post 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.
User avatar
tony
Posts: 49
Joined: Thu Apr 24, 2008 6:05 pm

Re: Using flash to store variables

Post 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
User avatar
Chris Ruff
Posts: 222
Joined: Thu Apr 24, 2008 4:09 pm
Location: topsail island, nc
Contact:

Re: Using flash to store variables

Post 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
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
gavinm
Posts: 59
Joined: Wed Jun 04, 2008 4:01 pm
Location: Nottingham UK

Re: Using flash to store variables

Post 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
Gavin Murray
ccoleman
Posts: 9
Joined: Wed Nov 05, 2008 8:55 am

Re: Using flash to store variables

Post 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.
bbracken
Posts: 54
Joined: Mon Jun 23, 2008 11:21 am
Location: Southern California
Contact:

Re: Using flash to store variables

Post 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
ccoleman
Posts: 9
Joined: Wed Nov 05, 2008 8:55 am

Re: Using flash to store variables

Post 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.
Post Reply