NXP RT1061 FlexSPI2 Clock Frequency Configuration Issue #87232
-
Hi, I have custom board with 3 Winbond flashes on
};` My goal is to set the clock frequency for these devices to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @ofirshe , I saw your related discussion on Discord. You shared you are already selecting It seems like your issue is related to the clock divider. Since your SCLK frequency is higher than expected, I recommend you step through this code on your board to understand the To get all the desired clock frequencies for your app, you may need to configure the clocks at the SOC level. For the RT10xx, most of these clocks are configured in clock_init() in soc.c. This is a When configuring clocks in the NXP MCUs, there is a helpful tool called MCUXpresso Clock Config Tool. This tool provides a GUI to configure all the clocks. It can generate code directly for MCUXpresso SDK projects. For Zephyr apps, that generated code does not drop in to the project yet. But you can copy the generated code needed into your Zephyr source to configure the clocks. I am sharing some additional details here that probably do not affect your board design, but may be important in other designs. First regarding the RT1064. This derivative is the same RT1060 SOC, but integrates a QSPI flash die in the package. That QSPI flash is connected to FlexSPI2, and the RT1064 will boot and XIP from FlexSPI2. In that case, changing the FlexSPI2 clock frequency is more challenging, and should not be done while XIPing. The other RT106x derivatives boot and execute from the primary FlexSPI instance, and in ofirshe's case the FlexSPI2 clock can be easily changed in the startup code while XIPing from the primary FlexSPI interface. The FlexSPI peripheral drives the output signal SCLK to the external memory. SCLK is derived from the internal serial root clock, which for FlexSPI2 is the output of the CCM_CBCMR[FLEXSPI2_PODF] divider. It appears ofirshe is using a Single Data Rate (SDR) QSPI flash here. With SDR, the SCLK output frequency is equal to the serial root clock frequency. With Double Data Rate (DDR) memories, the output SCLK frequency is half the serial root clock frequency. Best regards |
Beta Was this translation helpful? Give feedback.
Hi @ofirshe ,
I saw your related discussion on Discord. You shared you are already selecting
CONFIG_FLASH=y
. And you already found that some flash drivers call flexspi_clock_set_freq(). In your case, the driver flash_mcux_flexspi_nor.c does this by calling memc_flexspi_update_clock(), passing thespi-max-frequency
as the desired frequency.It seems like your issue is related to the clock divider.
flexspi_clock_set_freq()
will not change the clock source to the FlexSPI peripheral, but attempts to calculate a divider to program in CCM_CBCMR[FLEXSPI2_PODF]. I did some debugging on the MIMXRT1060-EVKC board, and stepped through this code. I see the FlexSPI2 clock is set twice using this flash…