LPC540 SPIFI Clock Reset

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

LPC540 SPIFI Clock Reset

459 Views
bzdan
Contributor I

Hello,

I'm currently working on a project where I need to store data in Flash so I need to configure the clock for the Serial Peripheral Interface Flash Interface (SPIFI) on an NXP microcontroller. I'm using LPC54S018-EVK board. However, when I added the clock configuration code, the microcontroller started hanging or crashing.

Here's the code snippet that causes the issue:

    CLOCK_SetClkDiv(kCLOCK_DivSpifiClk, 0U, true);                  /*!< Reset SPIFICLKDIV divider counter and halt it */
    CLOCK_SetClkDiv(kCLOCK_DivSpifiClk, 1U, false);                  /*!< Set SPIFICLKDIV divider to value 1 */

 

Has anyone encountered a similar issue when configuring the clock for the SPIFI interface? How can I properly configure the clock without causing the microcontroller to hang or crash?

From my understanding, it's essential to enable SPIFI peripherals in the clock configuration before utilizing them. However, considering that my binary is also uploaded to the SPI Flash memory, I'm unsure whether resetting this clock configuration could pose a problem. Is it possible that resetting the clock configuration for SPIFI peripherals could disrupt the operation of my uploaded binary (I can see XIP_IMAGE flag in my preprocessor configuration)?

0 Kudos
Reply
1 Reply

373 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi bzdan,

There is spifi demo code spifi_polling_transfer under SDK package which includes spifi interface clock configuration. Please take look at it.

The default SPIFI clock speed is 24MHz. I can use below code to change SPIFI clock to 96MHz without issue

ZhangJennie_0-1708071034417.png

Here SPIFI clock source is FRO96, clock divider is 1. In debugger we can see SPIFI clock speed 96MHz

ZhangJennie_1-1708071119191.png

Hope this helps,

Jun Zhang

 

 

0 Kudos
Reply