Regarding point 1. I have downloaded the SDK for the flashloader example but the MCUBOOT middelware is provided as an .ld file so I cannot see the sources.
Regarding point 2, we use the serial download on our end so I guess we won't be able to use the DCD. As the BSP we are using for the IMXRT106xEVKB board is not based on MCUExpresso, we have not gone through the usage of this tool but we are in the process of trying to generate a compatible SDK and go through some example (hello world would be the first then the flexSPI and SDRAM example).
Meanwhile, I have used the blhost utility to read back the flexSPI register and found out quite puzzling settings looking at the LUT configuration that you might help us understand.
- The data for read operation are the following:
| 0a 18 04 eb | 2 | 2 | 18 | 1 | 0 | eb | CMD_SDR 1_PAD_0xEB | RADDR_SDR 4_PAD 0x18 |
| 26 04 32 06 | 9 | 2 | 04 | C | 2 | 06 | DUMMY_SDR 4_PAD 0x06 READ_SDR 4_PAD 0x04 |
There is only another configuration in LUT1 for READ_STATUS but nothing for the WRITE, WRITE_STATUS or WRITE_ENABLE operation.
We are using an ADESTO AT25SF041 (512 kB) flash on this card which is connected to the A interface the flexSPI controller.
On this chip:
- a write to bit 1 of the 2nd byte of the status register is required to enable Quad read
- 3 dummy bytes (1 mode bytes + 2 dummy bytes) should be configured to enable proper read operation with the 0xEB command
-> how can the setting provided in the LUT allow proper write / read operations in the ivt_bootloader case ?
In addition, I have tried to figure out what would be a proper setting for the flexspi_nor_config_t configuration structure for our chip for the moment, the best I have come up with is the following. If you have any advice or suggestion on how I should set it up, it would be most welcome:
const flexspi_nor_config_t qspiflash_config = {
.memConfig =
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClksrc=kFlexSPIReadSampleClk_LoopbackInternally, //
// AT25SF041 5 ns (relative to clocks)
.csHoldTime = 3u,
.csSetupTime = 3u,
/* Introduce device Mode configuration to tune Quad enable bit reference */
.deviceModeCfgEnable = 1u,
.deviceModeType = kDeviceConfigCmdType_QuadEnable,
.deviceModeSeq = {
.seqId = NOR_CMD_LUT_SEQ_IDX_WRITE_STATUS,
.seqNum = 1u,
},
.deviceModeArg = 0x0200, // set Bit1 of byte 1 (=QE, quad enable)
/* End of deviceMode configuration */
.sflashPadType = kSerialFlash_4Pads,
// AT25SF041 Max freq is 104 MHz but 0x3B max freq is 85 MHz
.serialClkFreq = kFlexSpiSerialClk_80MHz,
.deviceType=kFlexSpiDeviceType_SerialNOR,
.sflashA1Size = 512u * 1024u,
.lookupTable =
{
/*0 - Read data */
[NOR_CMD_LUT_SEQ_IDX_READ*4+0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
[NOR_CMD_LUT_SEQ_IDX_READ*4+1] = FLEXSPI_LUT_SEQ(MODE8_DDR, FLEXSPI_4PAD, 0x00, DUMMY_SDR, FLEXSPI_4PAD, 0x02),
[NOR_CMD_LUT_SEQ_IDX_READ*4+2] = FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_4PAD, 0x04,STOP,0,0),
/* 2 - Write Enable (should be sent before Write Status)
* Writing the WriteEnable (0x06) command to assert WEL bit - no data writen afterwards
*/
[NOR_CMD_LUT_SEQ_IDX_WRITEENABLE*4+0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP,0,0),
/*7 - Write Status
* Writing afterwards the WriteStatus command (0x01) with 2 bytes of data
*/
[NOR_CMD_LUT_SEQ_IDX_WRITE_STATUS*4+0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, WRITE_SDR, FLEXSPI_1PAD, 0x02),
[NOR_CMD_LUT_SEQ_IDX_WRITE_STATUS*4+1] = FLEXSPI_LUT_SEQ(STOP,0,0,STOP,0,0),
},
},
};