Quest tion about placing data in SPIFlash

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

Quest tion about placing data in SPIFlash

824 Views
quyenngo
Contributor II

I have use macro to locate some function in to SPIFlash like this
__TEXT_EXT(Flash3,systick_delay) unsigned int  systick_delay() {
    return (unsigned)spifi_func;
}

I call this function in main(), and boot from internal flash bank A.

The first time i download software, LPC Expesso auto reset after download completion, software run OK.

But when I push reset button on board, it crash.

I use LPC4357 board by Embedded Artist

Labels (1)
Tags (3)
0 Kudos
3 Replies

495 Views
quyenngo
Contributor II

Thank you for your reply.

I have found that the cause of problem is I don't unlock the SPIFlash before copy the data from SPIFlash to RAM.

I add the function for unlock SPIFlash and it work when reset.

When I debug with LPC link2, it work well with out unlock SPIFash. I doubt that LPCExpresso auto unlock SPIFalsh when run in debug mode.

The similar problem occurs with Falsh Bank B. How can I unlock the internal flash bank B?

0 Kudos

495 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The boot story of the LPC43xx series is quite complex. If the part is configured to boot from SPIFI flash and no valid image is found in internal flash then SPIFI is initialised and the boot process begins.

If however a valid image is found in internal flash, then this will be booted in preference and SPIFI appears uninitialised.

The solution is to add the LPCOpen SPIFI initilisation code to your image running for internal flash (to perform the necessary pinmuxing and clock setup) You can see this in use in our Flash driver sources included with LPCXpresso IDE. I appreciate that our FAQs do not adequately cover this topic - and we will look to updating this.

Alternatively you could boot from SPIFI flash and use internal flash for data storage.

Yours,

LPCXpresso-Support

0 Kudos

495 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I presume that you are following the techniques shown in : Configuring projects to span multiple flash devices  ?

It would be worth checking the map file generated by the linker to make sure things have been placed as you expect.

Also double check your debug log to make sure that both the internal flash and external flash are being programmed : https://community.nxp.com/message/630852 

But more likely is that the problem is due to your code not setting up pinmuxing and clock for the SPIFI interface (which will be being done by the flash driver when you debug). 

Regards,

LPCXpresso Support

0 Kudos