Using LPC1769 code Flash as Data storage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using LPC1769 code Flash as Data storage

1,204 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gminnucci on Mon Mar 04 13:50:45 MST 2013
Hi everybody.

I'm trying to use code flash memory to store Non-Volatil parameters.
I want to modify these parameters during execution with some Read / Write Functions.
Is there a library that implements R/W to flash ?
I mean a sort of "memcpy" o "flashwrite" function to update the parameters in flash.
unsigned char flash_write(unsigned long address, char databyte);
databyte = flash_read(unsigned long address);


I read about IAP functions but I want to know if there a shortcut...

Thanks in advance.
Gustavo
0 Kudos
Reply
7 Replies

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gminnucci on Thu Mar 07 13:30:42 MST 2013

Quote: stalisman
The trouble with reading is that most of what is read is written poorly in the first place. It is good to read but it is better to read, question and then understand. That's what forums are for, not just to be told rtfm.

Data held in flash paramaterises the system and hence could be said to 'govern' the system. As with real world Governments it is best to not change them too often and when doing so it is usual to change it all in one go. You only have to look at Italy to see how too many random changes lead to chaos.

The moral: change flash only after reasoned consideration of the benefits not at random.

:-)



:) I got the point. Thx Stalisman
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by stalisman on Thu Mar 07 01:57:22 MST 2013
The trouble with reading is that most of what is read is written poorly in the first place. It is good to read but it is better to read, question and then understand. That's what forums are for, not just to be told rtfm.

Data held in flash paramaterises the system and hence could be said to 'govern' the system. As with real world Governments it is best to not change them too often and when doing so it is usual to change it all in one go. You only have to look at Italy to see how too many random changes lead to chaos.

The moral: change flash only after reasoned consideration of the benefits not at random.

:-)
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gminnucci on Wed Mar 06 21:33:52 MST 2013
Thx Pals....
... I had a complete month reading & reading & reading & reading & reading & reading & reading & reading & reading & reading & reading & reading... :)
Regards.
Gus
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Wed Mar 06 06:48:01 MST 2013
Have you tried doing a forum search for "IAP" - lots of previous questions (and answers) on this subject.

And you have already looked at NXP's application notes???? :)

http://www.lpcware.com/content/nxpfile/an11008-flash-based-non-volatile-storage-software
http://www.lpcware.com/content/nxpfile/an11071-application-programming-lpc1700

HTH!
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Wed Mar 06 06:08:27 MST 2013

Quote: Gustavo

I saw the User's Manual but it seems it only manages 256-byte blocks.
Do I have to rewrite the functions to R/W a different block  length ?


The "page-ness" of Nand is always going to be the drawback of flash storage compared to using EEPROM externally or in other micros. If you can afford the space just use a whole 256 page for the storage of a single item. Otherwise, yes, you have to implement a scheme where to change just a few bytes within a page you need to copy the entire thing, change the few bytes, then write back the whole thing.
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gminnucci on Tue Mar 05 19:17:18 MST 2013

Quote: wrighflyer
What could possibly be shorter than the fact that NXP already wrote all the code you need?

IAP command 50 is "prepare sectors for write" then command 51 is "copy RAM to flash". Surely that's the very "memcpy" you are looking for?

See "32.8 IAP Command" in UM10360.


Thx 4 the reply....
I saw the User's Manual but it seems it only manages 256-byte blocks.
Do I have to rewrite the functions to R/W a different block  length ?
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wrighflyer on Tue Mar 05 03:35:03 MST 2013

Quote: Gustavo
I read about IAP functions but I want to know if there a shortcut...


What could possibly be shorter than the fact that NXP already wrote all the code you need?

IAP command 50 is "prepare sectors for write" then command 51 is "copy RAM to flash". Surely that's the very "memcpy" you are looking for?

See "32.8 IAP Command" in UM10360.
0 Kudos
Reply