We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi devlopers, I am usign LPC 2138 ARM controller right now. It has only 32 Kb of SRAM, I have one array say " char Table[300][300] " of approx. 100 Kb. I want to store this table in on chip flash memory which is 512 Kb, can anyone guide me how to accomplish this task. I am using Keil u vision3 compioler and MCB 2138 board [having LPC2138 controller], and using flash programming with LPC flash utility [COM]. Thanks in advance, Saurabh Pandya
I am not aware of the exact procedure to be followed for writing data to the flash memory for the device that you are using, but then in case of MSC1210 there are hardware configuration bits for alloting the size of flash to be used as data. This area of the memory has to be accessed using ROM routines already resident in the MSC.
It probably also depends on which compiler you're using - GCC, CARM, or RealView? http://www.keil.com/arm/
You can locate the array at an address in flash. See the linker manual for directives to locate a segment, or the "at" keyword, if that's supported on the ARM compiler. However, the compiler will not automatically generate a sequence of flash programming commands. You won't be able to store values the array simply by using an assignment statement.
"the compiler will not automatically generate a sequence of flash programming commands" Actually, it might be able to do this - the C51 compiler certainly can! You will have to check the appropriate Manual to see if your particular ARM compiler also has this feature and, if so, how to use it...
Thanks to all for kind responce. I am cheking out also other possibilities to impliment certain functionality, Is IAP can help me ? One more thing My system is very strict about faster readout and fast write timings. Can suggest me some more brainstrom?? Regards & Thanks, Saurabh Pandya
You should consider also the min. block size which may be written to flash at once - a page size. Philips devices are using ECC technology for error correction which greatly improves the flash error tolerance, but on the other hand makes read/modify write sequences almost unusable. For example when a flash cell has some value programmed, and you want to modify it by programming some additional bits to 0. Doing so on one cell will influece the data read from the neigbouring cell from the same page. This is a result of the ECC, which is hidden to the user and tries to correct single bit errors on a flash page. Franc
Andy wrote: the C51 compiler certainly can [generate flash programming sequences for assignment statements] Can you give me a pointer to the right manual and section? "Flash" only occurs a couple of times in the C51 manual, nor did anything in the library manual jump out at me. I'd expect some sample code in the lib directory as well, so you could customize the hooks to an unusual flash type if necessary.
"Can you give me a pointer to the right manual and section? "Flash" only occurs a couple of times in the C51 manual," It would be done via the XDATA banking support. There are examples for working with EEPROM such that 'C' variables can be located in EEPROM (including serial EEPROM) and accessed "apparently" just like any other 'C' variable. I'm sure you should be be able to adopt the same techniques for flash... Note: this is C51 - I don't know if any or all of the ARM compilers has anything similar.
[Flash access] would be done via the XDATA banking support. I get it. Thanks.
Dear Devlopers. I have checked IAP capabilities in Phlips LPC 2138. Seems it allows devloper to write whole 512/1024/.../4xxx bytes in to flash memory using various IAP commands. as per give in LPC_2132_2138 User mannual. But How can I read those data/ part of data written in to flash - back to RAM array. Regards & Thanks Saurabh Pandya
Dear friend. Thanks for kind support. I am now able to save my whole "char table[400][300]" on onchip flash of LPC2138 [512 kb]. I have used various IAP commands for this. I want to read various parts of this table back to SRAM , i read in Data sheet that, reading of flash can be accomplish through absolute addressing. But it is not working somehow, and i am not ablr to read data back. I am using following code (psudo) char *FlashPointer; /* pointer that points 1st location of sector 5 */ FlashPointer = 0x5000; for(Count=0;Count<NumberOfChars;Count++) { TempChar = (unsigned char) (&FlashPointer) /* Read content from this location*/ putchar(TempChar); // Send to RS232 FlashPointer++; } Please adive me , how to read data back from flash memory.... Thanks
How did u read back from Flash location in IAP, because I didn't get any command for it in the manual. One more thing about IAP, whether IAP is only used for run-time programming? Means when program is running in device and without stopping that program we want to load new program then only IAP is used? Is it so? Please clear this doubt...I am confused about this..
to store variables in flash in runtime, isn't it possible in ISP?
ISP means In-System Programming (or "Programmable") This means that the chip can be programmed in-situ, without having to be removed and placed into a special programming tool.
IAP means In-Application Programming (or "Programmable") This means that the chip can be programmed while it is still running its Application.
Clearly, IAP requires ISP.
However, ISP does not imply IAP
In many cases where IAP facilities are provided, they are intended for code storage - they not well suited to data storage.
"How to read back from flash"
ARM processors generally have continous memory map, Review the memory map of your controller. You can directly read data from flash locations [using some mean of pointers]
Yes, IAP is real time. Its allows to read and write flash during program execution. And offcourse you can update your program ,using IAP that is firmware update. But I dont have much information about this.
Thanks 2 all.
I got what I wanted to do. I had made use of IAP. And it works fine..
Carry on to provide kind response.. Thanks..