Initializing & defning array of data on external Flash via SPIFI intrerface

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

Initializing & defning array of data on external Flash via SPIFI intrerface

1,222 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ashgupta28 on Wed Dec 03 04:49:28 MST 2014
I want to place these data at 0x14000000 (memory mapped area of external flash)
__DATA(RAM6) uint32_t spifi_buffer_a[1024];
__DATA(RAM6)  uint32_t spifi_buffer_b[1024];

I have already initialized the Spifi inside Board_SystemInit(); function. BUT i the code is jumping to hard fault handler.
I have created an extra RAM_SPIFI named RAM6 in MCU Settings of LPC Xpresso with starting address 0x14000000 & size as 0x1000.


After initializing SPIFI flash interface & setting it in memory mode, How i am able to initialize any variable at 0x14000000 memory area.

Thanks in advance :)
Labels (1)
0 Kudos
Reply
13 Replies

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Mon Feb 09 05:51:33 MST 2015
I will handle this issue in the other post here:

http://www.lpcware.com/content/forum/linker-copy-spifi-objects-sdram-causes-hard-fault#comment-11434...

Regards,
NXP Support Team
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rmoss on Thu Feb 05 10:17:26 MST 2015
Hi mc,
Thanks for the response.  This is where my problem is, when the variables copied from SPIFI to SDRAM by the init startup code is causing hard fault.  At least in IAR EW, between low_level_init() and main the linker directive to copy from SPIFI to SDRAM is not working correct. 

Thanks
Robert
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Feb 04 13:27:00 MST 2015
Hi rmoss,
This is true for any Flash, e.g. internal, external parallel, external serial etc. Flash can  only contains constant data during execution. Similarly, if Serial NOR flash is connected to SPIFI interface, it can only contain constant data. All variables will be placed in RAM (SRAM/SDRAM).
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rmoss on Wed Feb 04 08:28:39 MST 2015
Hi Bavarian,
Regarding this post, I have submitted a post yesterday with similar issues.  When you say "you can place const data into flash memory, but not variables", is this in the case of the SPIFI only?  I have placed an entire object in the SPIFI and get the Hard Fault when the linker is placing the object from SPIFI to SDRAM.  I have done this successfully using the LPC1788 and external parallel flash.  My post from yesterday is "Linker copy SPIFI objects to SDRAM causes Hard Fault".  Any thoughts on why the linker is behaving this way (IAR EW V6.6, LPC1857, Spansion SPIFI)
Thanks,
Robert
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Wed Dec 17 02:33:01 MST 2014
Sorry for the confusion. The SST26VF032 is of course a qSPI flash.
TheFallGuy mixed it up with the SST39VF3201 NOR flash device, which is used on the Hitex evaluation board.

I expect that this flash works in the same way as the S25FL032.

Regarding your initial problem: you can place const data into the flash memory, but not variables. They need to go into a RAM area. You can do this manually or leave it up to the linker to place them into an area defined as RAM.

Regards,
NXP Support Team.
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ashgupta28 on Tue Dec 09 23:31:59 MST 2014
So you are saying SST flash chip do not support SPIFI interface. So it should only be communicated via SSP interfce.

As per my understanding:-
SST26VF032 is a Serial Quad I/O (SQI) Flash Memory.
Similarly S25FL032P 32-Mbit CMOS 3.0 Volt Flash Memory is also a 104-MHz SPI (Serial Peripheral Interface) Multi I/O Bus
Here attached a screen shot of App Note by SPIFI NXP:-


Both the Flash are external Flash . So if S25FL032P is SPIFI flash then i guess SST26VF032 iis also a SPIFI flash. Please correct me if I am wrong.
If SSt flash is not a SPIFI flash, can i modify the Spifi library to support the external flash.


One more question:-
If SSt is not a SPIFI flash, how can i able to communicate with this external Flash.
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue Dec 09 02:41:54 MST 2014
If you download the docs, you will find how to use the library, and which parts are supported:
http://www.lpcware.com/system/files/spifilib_html_v1_00.zip

*EDIT*
The  device you mention (SST...) is an external Flash. It is not SPIFI flash, and so the SPIFI library is not going to support it...
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ashgupta28 on Tue Dec 09 01:52:00 MST 2014
Thanks for the info :)

Do this library supports also  SStVF26VF016 or 032 flash chip. Please also share the sample example of using SPIFI library with this SST26VF016 Flash chip.
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 04 04:14:51 MST 2014
SPIFI flash is not RAM!! You cannot locate RW global data into the SPIFI address range an expect to be able to treat it as RAM.

If you want to write data into SPIFI flash memory, then you will need to include functions in your application to write to the appropriate registers to cause writes to it - such as the LPCOpen lpcspifilib…

http://www.lpcware.com/SPIFI

This blog also gives some useful background information…

http://www.lpcware.com/content/blog/introduction-spifi

Regards,
LPCXpresso Support
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ashgupta28 on Thu Dec 04 01:48:25 MST 2014
The main point is i have connected external Flash with LPC1857 via SPIFI interface. The same setup as in MCB1800 evualtion board(LPC1857 connected to Spansion external Flash via SPIFI interface).

Now i want to define variables at external flash (memory mapped area at LPC1857 @0x14000000). for that i have created RAM6 starting at address 0x14000000 in MCU settings & initialized the external Flash in startup file in BoardSystemInit() function.
I have used this approach to place these array of data at RAM6 (0x14000000) also checked in memory map file(both are assigned at 0x14000000)
__DATA(RAM6) uint32_t spifi_buffer_a[16];
__DATA(RAM6) uint32_t spifi_buffer_b[16];

But when i try to read or write at this array, code jumps to HARD FAULT HANDLER.

0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Dec 04 01:18:58 MST 2014
I am not sure where SPIFI comes into your setup.

Global data items will be automatically placed into RAM during execution. The startup code will automatically copy its initial value from flash into the first bank of RAM. You should not need to do anything unless you want to have the data located in a different location during execution.

If you look at the map file generated by the linker, you will see the location that the initial values of data are at in flash, and their runtime location.

If you want to place  a particular global data item into a different RAM bank, that is when you can use the __DATA macro. For more information see:

http://www.lpcware.com/content/faq/lpcxpresso/data-different-ram-blocks

And this FAQ explains how to determine the size of the code/data in your image:

http://www.lpcware.com/content/faq/lpcxpresso/application-flash-ram-size

You may also find this external article useful:

http://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/

Regards,
LPCXpresso Support

0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ashgupta28 on Wed Dec 03 22:16:39 MST 2014
Hello,

I may have to place constant data but currently i only have to place database that are not constant. These array of database can be filled with data at any time of running code.
1) I am using LPC1857 evaluation board
2) Currently i am using LPC1857 populated on it but in future i have to use LPC1833. I guess both have similar functionality as per SPIFI interface
3) I am booting from internal flash
0 Kudos
Reply

1,120 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Dec 03 16:25:35 MST 2014
Hi ashgupta28,
Do you want to place constant data in external flash? You need different directive for that. Please post below information.
1) Which board are you using?
2) Which LPC device are you using?
3) Are you booting from internal flash or from SPIFI?

0 Kudos
Reply