-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Hi,
I've got a question regarding the setup of the FlexSPI for i.MX RT.
In the i.MX RT HAL there's this definition
Line 331 in 3801b49
#define CONFIG_SERIAL_CLK_FREQ kFlexSpiSerialClk_100MHz |
which is used to generate the FCB (Flash Configuration Block) that goes into the first 4KiB of flash to be read by the BootROM.
Later, in hal_flash_init()
if USE_GET_CONFIG
is defined, the FlexSPI configuration is read and then used to initialize the FlexSPI again.
Lines 887 to 894 in 3801b49
ret = g_bootloaderTree->flexSpiNorDriver->get_config( | |
CONFIG_FLASH_FLEXSPI_INSTANCE, | |
&flexspi_config, | |
&flexspi_cfg_option); | |
if (ret == kStatus_Success) { | |
ret = g_bootloaderTree->flexSpiNorDriver->init( | |
CONFIG_FLASH_FLEXSPI_INSTANCE, | |
&flexspi_config); |
However, the flexspi_cfg_option
is set to a value that specifies a max frequency (0x7 = 7d = 120MHz) when getting the configuration.
Line 881 in 3801b49
flexspi_cfg_option.option0.U = 0xC0000007; /* QuadSPI-NOR, f = default */ |
From testing it seems that when getting the FlexSPI configuration the returned configuration has its frequency set to 0x7 even though the frequency specified in the FCB is 100MHz = 6d = 0x6
. Thus, when initializing the FlexSPI afterwards the frequency won't match what was specified in the FCB.
I'm not sure if this is intentional, but it doesn't seem like it is as the FCB is populated with a specific value that's then "discarded" later while initializing the platform?
Some additional resources:
Frequency mapping from reference manual for i.MX RT 1060
Capture of QSPI interface traffic between our i.MX RT1061 and our flash chip (note that I changed the frequency in the FCB to 30MHz and the value in flexspi_cfg_option.option0.U = 0xC0000002
to instead go from 30MHz to 50Mhz to be able to capture the frequency with a Saleae Logic 8 Pro)
- Before
g_bootloaderTree->flexSpiNorDriver->init()

- After
g_bootloaderTree->flexSpiNorDriver->init()

Kind regards,
Daniel