Build a LPC54S018J4M spifi bootloader into sram to programming internal 4M flash

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

Build a LPC54S018J4M spifi bootloader into sram to programming internal 4M flash

Jump to solution
852 Views
springc
Contributor II

Hi, 

I am going to build a bootloader, would like to program internal spifi 4M flash in LPC54S018J4MET180E. My developement environment is IAR. J-LINK (SWD). IC version is 1B. 

I found the errata of https://www.zlgmcu.com/data/upload/file/Utilitymcu/LPC540xx-kanwu.pdf . 

springc_7-1646649687703.png

I means it should be implement programming functions by self, right?! 

So, I get the example code package from NXP from as SDK_2_11_0_LPC54S018J4M.zip. 

There is a example code in \SDK_2_11_0_LPC54S018J4M\boards\lpcxpresso54s018m\driver_examples\spifi\polling_transfer\. 

spifi_polling_transfer.c seems a good example for execute programming/ erasing internal flash.

But, I try it and still have problem. Need to call help from you ~~

I am make sure the SPIFI command is set corrcot to 0x40080000 SPIFI command registers. and also include startup_LPC54S018M.s to initial W25Q32JV without XIP_IMAGE & ADD_CRC define. 

Question: 

1. Base on SDK_2_11_0_LPC54S018J4M package spifi_polling_transfer.c main (). how many files has to include? (ex. iar_lib_power.a,  startup_LPC54S018M.s ... ?)

2. How to correct to config icf for ram_bootloader?

3. How to set base option of project for this?

4. After SPIFI_INIT (), the memory show as below:

springc_2-1646648196067.pngspringc_3-1646648208862.pngspringc_4-1646648221089.pngspringc_5-1646648232661.pngspringc_6-1646648245886.png

It means already copy 0x3000000 rom code 512 byte to 0x0 sramx region. my bootloader image also download to sram0 0x20000000. but, flash 0x10000000 shows all 0s. 0x40080014 always un-readable. Erase/ Write flash do nothing. What is the trouble on this? 

5. One more strange, If I set Project\Option\J-Link\Setup\ reset by "Core". I can do my function well, once implement J-Flash to read or write function. But set "Reset Pin", "Core and periperals" & "Normal" are still not work. I guess some of peripherals parameters is not set or incorrect, like as PLL or clock speed not match, setting sequency, or somehow. could some one help to give a hand?!

Extra information:

J-Flash (J-Link) is workable (Read/ Write/ Erase) at my board base on this project. 

springc_0-1646647692466.pngspringc_1-1646647840435.png

 

 

Tags (1)
0 Kudos
1 Solution
808 Views
Alice_Yang
NXP TechSupport
NXP TechSupport
0 Kudos
3 Replies
821 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

About using bootloader on lpc54s018J4M, how about using method as blow thread:

https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/Use-blhost-to-program-erase-LPC540xxM-LP...  

 

BR

Alice

0 Kudos
817 Views
springc
Contributor II

Hi, Alice, 

Download flashtloader is no problem by J-link tools. Thanks for give me an other ways to tranfer flashloader to ram. 

I found access internal Flash, also need to initial external flash (IOCON). 

So, now I can access the 0x10000000 correctly.

Thanks for your response ~~

0 Kudos
809 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Welcome!

 

0 Kudos