Hi all,
We are preparing bringup of a custom board based on i.MX RT1170. The MCU is populated with a Micron MT25QL02GCBB QSPI NOR flash, through the secondary FlexSPI interface, secondary pin group. For debug purposes we intend to connect a MCU-Link Debug Probe, and the end goal is to run Zephyr RTOS as operating system.
As per the PRM we anticipate burning the fuses: BT_FUSE_SEL, FLEXSPI_INSTANCE and FLEXSPI_PIN_GROUP to instruct the boot ROM about the particular interface- and configuration.
$ fd cfx /usr/local/LinkServer | rg 1170 | rg SFDP | rg QSPI
/usr/local/LinkServer/binaries/Flash/MIMXRT1170_FlexSPI2_A_SFDP_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1170_SFDP_QSPI.cfx$ fd cfx /usr/local/LinkServer | rg 1180 | rg SFDP | rg QSPI
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI1_A_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI1_A_QSPI_S.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI1_B_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI1_B_QSPI_S.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_PriGr_A_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_PriGr_A_QSPI_S.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_PriGr_B_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_PriGr_B_QSPI_S.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_SecGr_A_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_SecGr_A_QSPI_S.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_SecGr_B_QSPI.cfx
/usr/local/LinkServer/binaries/Flash/MIMXRT1180_SFDP_FlexSPI2_SecGr_B_QSPI_S.cfxHi @anbn ,
Yes, your understanding is correct! This GUI view is some king of working set, if you set it up correctly and click the test button, the tool would send such info to ROM for verification as if the ROM gets such info from the FCB on flash. If the result is good, you may convert it to complete FCB and then SPT would program it on the space for FCB on flash as well as save it as a bin file on your local drive for further usage.
Hope that makes sense,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
We haven't received our board yet, so we're trying to minimize bringup time by having a good understanding of at least the minimal configuration.
Using single pad SPI could also simplify setup, as we don't need speed to verify the basics.
Is testing the configuration on a physical board a requirement to make the fcb with secure provisioning tool?
I've tried to put together this minimal FCB with single pad spi commands matching the datasheet.
Does it look like a working setup or have I misunderstood something?
Also, does the boot ROM use SFDP to overwrite these settings or is that only a thing for the cfx driver while flashing the code?
We appreciate the help very much, as we're on a tight schedule when we receive the custom units.
const flexspi_nor_config_t mt25ql_minimal_config = {
.memConfig = {
.tag = FLEXSPI_CFG_BLK_TAG, // Identifier for FCB
.version = FLEXSPI_CFG_BLK_VERSION, // FCB version
// Use internal loopback for read sampling (no DQS pad)
.readSampleClksrc=kFlexSpiReadSampleClk_InternalLoopback,
.csHoldTime = 3, // Chip Select hold time
.csSetupTime = 3, // Chip Select setup time
// No device mode configuration (no QE bit needed)
.deviceModeCfgEnable = 0,
.deviceModeType = 0,
.deviceModeSeq = {0, 0},
.deviceModeArg = 0,
.configCmdEnable = 0, // No extra config commands
// Misc options:
// - Bit 4: Enable second pinmux group
.controllerMiscOption = (1 << kFlexSpiMiscOffset_SecondPinMux),
.deviceType = kFlexSpiDeviceType_SerialNOR, // Serial NOR flash
.sflashPadType = kSerialFlash_1Pad, // Standard SPI mode
.serialClkFreq = kFlexSpiSerialClk_60MHz, // 60 MHz clock
.sflashA1Size = 256 * 1024 * 1024, // 256 MiB flash size
.dataValidTime = {16, 16}, // Default timing
.busyOffset = 0, // Status register offset
.busyBitPolarity = 1, // Busy bit is active high
// Lookup Table (LUT) for basic SPI commands
.lookupTable = {
// LUT[0] - Fast Read (0x0B)
// 1. Send 0x0B command on 1 pad
// 2. Send 24-bit address on 1 pad
// 3. Send 8 dummy cycles
// 4. Read data on 1 pad
[0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x0B,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
[1] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_DUMMY, kFLEXSPI_1PAD, 0x08,
kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x04),
// LUT[4] - Write Enable (0x06)
[4] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x06,
kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),
// LUT[5] - Page Program (0x02)
[5] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x02,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
[6] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x04,
kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),
// LUT[7] - Sector Erase (0xD8)
[7] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xD8,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18),
// LUT[8] - Read Status Register (0x05)
[8] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x05,
kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01),
},
},
.pageSize = 256, // Page size in bytes
.sectorSize = 64 * 1024, // Sector size in bytes
.blockSize = 256 * 1024, // Block size in bytes
.isUniformBlockSize = true, // All blocks are same size
};Hi @anbn ,
Have you connected with your custom board in Serial Download mode and pressed the test button? Was the result passed? for query and cmd pads I think they should be one, only when you set it in quad mode , the flash uses 4 pads for data IOs.
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kan
Thank you for that link - it helped my understanding.
I'm trying to use the template of Secure Provisioning Tool to create the FCB but I consistently get this message.
I'm a little bit unsure about the quad mode setting - according to the datasheet entering quad i/o mode is handled by command 35h which doesnt seem available.
Hi @mns ,
I am referring to qspiflash_config which includs the parts as you mentioned.
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Thanks @Kan_Li for the quick reply. Regarding the statement:
"...leave FCB as it was, .."
I am not sure what you mean? Are you referring to leaving the 'lookupTable' structure (https://github.com/zephyrproject-rtos/zephyr/blob/88de138290b683c26abf81142756621a02169eb5/boards/nx...) meawhile filling out the remainder of the 'memConfig' (https://github.com/zephyrproject-rtos/zephyr/blob/88de138290b683c26abf81142756621a02169eb5/boards/nx...) structure as the foundation for the FCB?
Thanks again,
Martin
Hi @anbn ,
The drivers out of the SDK should be used with the EVKs, so if you design a custom board with flash other than the part used on EVKs , you have to customize the flash loader as well. We provide a guide for that purpose, please kindly refer https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs-Knowledge/RT1170-flexSPI1-secondary-QSPI-flash-d... for details.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kan
Thank you for the quick reply. I'm on Martins team working on the same project.
Can we use the MIMXRT1170_FlexSPI2_A_SFDP_QSPI.cfx as is or do we need to customize the code for our Flash IC? I see config option for the secondary pin group which is also set by efuse - is this redundant?
Anything else we must customize in the driver?
Specifically - do we need to set CONFIG_OPTION1 to use the secondary pin group and recompile iMXRT117x_FlexSPI_SFDP? (Also, does that example driver include anything from the board/project?)
Does it need to be compiled with our pinmux and/or together with our custom board in MCUXpresso IDE?
Are there any tools we can use to generate a working flexspi_nor_config for our Flash IC and board?
We're trying to eliminate as many uncertainties as possible before bringup, so we appreciate the help very much.
Best regards
Anders
Hi @mns ,
Yes, your understanding is correct! For your case, if FlexSPI2 2nd pin group is used for connecting with the nor flash, you have to develop a custom flash loader for the debugger, such as link server, and also you need to adapt the efuses as you mentioned with a proper FCB for your application, the FCB also set up the flexspi instance and pin group selection, so if you just program the efuse and leave FCB as it was, the boot ROM may find the flash with the help of efuses, but would be lead to a wrong place to fetch your application after checking the FCB part.
the LUTs can be updated by your application code if you want to add more , the sdk demo of evkmimxrt1170_flexspi_nor_polling_transfer_cm7 provides an example for this topic.
Hope that makes sense,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------