I tried to migrate my project from LPC4337 to LPC4320. Since LPC4320 has no internal Flash, I mounted a piece of MX25L8035E on the SPIFI interface and set it to boot from SPIFI.
When this project runs on LPC4337, the CPU usage rate is only 20%, but when it runs on LPC4320, the CPU usage rate reaches 100%, and the task execution frequency does not reach the predetermined value.
I try to change the CTRL register SPIFI_CTRL_CSHI in SPIFI to 0, and the program execution speed is accelerated, but the task execution frequency is still lower than the predetermined value, and the CPU usage is still 100%.
For this kind of microcontroller with external Flash, is it necessary to make some special settings for SPIFI to improve performance?
The following is my code for configuring SPIFI in SystemInit(). The compiler I use is Keil MDK.
Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IRC, true, false);
LPC_SPIFI->CTRL = SPIFI_CTRL_TO(0x0)|\
SPIFI_CTRL_CSHI(0x0)|\
SPIFI_CTRL_DATA_PREFETCH_DISABLE(0)|\
SPIFI_CTRL_INTEN(0)|\
SPIFI_CTRL_MODE3(0)|\
SPIFI_CTRL_PREFETCH_DISABLE(0)|\
SPIFI_CTRL_DUAL(0)|\
SPIFI_CTRL_RFCLK(1)|\
SPIFI_CTRL_FBCLK(1)|\
SPIFI_CTRL_DMAEN(0);
Chip_SetupCoreClock(CLKIN_CRYSTAL, 204000000, true);
Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, 2);
Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IDIVE, true, false);