Hi,
Preface:
we are using an LPC1850 flashless CortexM3 in our new design. We want to use a SPIFI Flash to store the
application. We already have prototypes boards.
We use IAR Embedded Workbench V7.8 and a Segger J-Link debugger for development.
Firstly we assembled an Cypress/Spansion S25FL164K0XMFI00 SPIFI flash, but we could not load the application into that flash. The IAR Flashloader always reported an error. Also the direct download with J-Link without IAR FlashLoader did not work.
Then I assembled an Cypress/Spansion S25FL129P0XMFI010 SPIFI flash. That worked! It downloads not so fast, but I works.
I´m in contact with IAR to find the reason why the S25FL164 does not work with their FlashLoader.
Unfortunately the working SPIFI Flash S25FL129P is not recommended for new designs, so for the start of the production we need a solution with another flash.
For the prototypes I have a working solution, BUT I have a problem with the speed respectively with the SPIFI Clock.
The SPIFI Clock is only running at ~18MHz.
My application with resistitve touch and 480x272 display is running a bit slow
(Main Clock is at 168MHz, external crystal with 12MHz, PLL1 is set to 16)) and I think the reason is that the SPIFI Clock is to slow.
As mentioned in the User Manual of the LPC1850 (page 51/52), the SPIFI Clock starts at boot time with 32MHz for a quad SPI Flash. The clock is reduced to 18MHz if the flash isn´t recognized. That is exactly what I see on the oscilloscope.
So my question is:
How can I increase the SPIFI Clock? What is the correct way to do that?
We are using the CMSIS drivers, also the "lpc18xx_cgu.c (V1.0)" to setup the system clocks.
I tried the following to increase the SPIFI Clock using the CMSIS driver, but the clock stays at 18MHz.
CGU_SetDIV(CGU_CLKSRC_IDIVA, 4);
CGU_EntityConnect(CGU_CLKSRC_PLL1, CGU_CLKSRC_IDIVA);
CGU_EnableEntity(CGU_CLKSRC_IDIVA, ENABLE);
freq = CGU_GetPCLKFrequency(CGU_PERIPHERAL_SPIFI); // -> result 18MHz
CGU_EntityConnect(CGU_CLKSRC_IDIVA,CGU_PERIPHERAL_SPIFI);
CGU_EnableEntity(CGU_BASE_SPIFI, ENABLE);
CGU_UpdateClock();
freq = CGU_GetPCLKFrequency(CGU_PERIPHERAL_SPIFI); // -> result 18MHz
I also tried to use the NXP SPIFI lib (V1.03.68)
spifiInit(LPC_SPIFI_BASE, false);
spifiRegisterFamily(spifi_REG_FAMILY_CommonCommandSet);
handleSize = spifiGetHandleMemSize(LPC_SPIFI_BASE);
but the call of the third line (spifiGetHandleMemSize) stalls the debugger.
The IAR FlashLoader also uses the NXP SPIFI lib and I copied that three calls from the source code of that FlashLoader.
When I ran the FlashLoader project, which executes in RAM(!), the call of spifiGetHandleMemSize works and returns 64.
Here is my question again:
How can I increase the SPIFI Clock? What is the correct way to do that?
I hope I explained my problem comprehensible. I have attached a schematic of the LPC1850 and SPIFI Flash connection.
Many thanks for any help in advantage.
Kind regards
Kai
Solved! Go to Solution.
Hi Kai,
In your last reply, you had illustrated the codes to update the frequency of the SPIFI.
In my opinion, these above codes should be executed in RAM to speed up the the frequency of the SPIFI, and the spifiInit function is necessary to be called as the function had already be done when booting from the SPIFI flash.
Hope this is clear.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Kai Becker,
According to reference manual, the S25FL129 will work with 32 MHz when choose the SPIFI boot mode (See Fig1 ).
Fig 1
It seems so weird, and you should relocate these API in the RAM prior to utilize the SPIFI library API.
And I'd like to share a thread :Relocating code from FLASH to RAM with you, and please refer to details.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ping,
thank you very much for your answer.
The S25FL129 should work with even higher frequencies. According to the datasheet of the S25FL129P0XMFI010 it should work with 80MHz.
As I said. I see on my oscilloscope that the boot process starts with 32MHz (quad)
and is then reduced to 18MHz after ~0,5s - 1s.
Yes you´re right concerning the relocation of the SPIFI API.
I have to read the IAR Linker manual to see how the relocation is done using the IAR Embedded Workbench.
You´re link refers to the LPCXpresso IDE which uses the gcc compiler/linker.
This syntax surely differs from the IAR syntax.
The relocation of the SPIFI Lib API could be a first try, but even if I manage to relocate the SPIFI Lib API to RAM, I don´t understand how to increase the SPIFI Clock Speed.
In the SPIFI Lib there is now call or parameter for the SPIFI Clock.
Maybe others here have an idea?
Nevertheless Ping. Many thanks for your help!
Kind regards
Kai
Hi Kai,
In your last reply, you had illustrated the codes to update the frequency of the SPIFI.
In my opinion, these above codes should be executed in RAM to speed up the the frequency of the SPIFI, and the spifiInit function is necessary to be called as the function had already be done when booting from the SPIFI flash.
Hope this is clear.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ping,
again thank you for your answer.
I think you´re right.
I examined the source code of the SPIFI lib and I found that there are a lot of SPIFI devices described.
Even the clock rates.
So hopefully the calls of the SPIFI Lib will also increase the SPIFI clock automatically.
Now I have to figure out, how I can copy the SPIFI Lib to internal RAM at startup, execute the necessary API calls and jump then back to SPIFI execution (with IAR Embedded Workbench).
Many thanks again!
Kind regards
Kai