Hi all,
We just got first prototypes of out own design with the following components:
- MCU is MIMXRT1061CVL5B
- FLASH memory is microchip SST26VF064B connected to QSPI1
- J-link SWD for debug
Project is built with MCUXpresso IDE.
The basics of the build is taken from the MIMXRT1060-EVKB-DEVKIT examples, the device is changed to 1061 and the evkmimxrt1060_flexspi_nor_config.c looks like:
const flexspi_nor_config_t qspiflash_config = {
.memConfig =
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClksrc=kFlexSPIReadSampleClk_LoopbackInternally,
.csHoldTime = 3u,
.csSetupTime = 3u,
.controllerMiscOption = (1u << kFlexSpiMiscOffset_SafeConfigFreqEnable),
.deviceType = kFlexSpiDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_80MHz,
.sflashA1Size = 8u * 1024u * 1024u,
.lookupTable =
{
// Read LUTs
[0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), // SPI Quad I/O Read: EBH, 24bit address
[1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04), // 6 dummy cycles, read data in 4 bit blocks
// Read Status LUTs
[4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04), // Read-Status Register : 05H,
// Write Enable LUTs
[4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0), // Write-Enable: 06H
// Erase Sector LUTs
[4 * 5 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, RADDR_SDR, FLEXSPI_1PAD, 0x18), // Sector-Erase:20H, 24bit address
// Erase Block LUTs
[4 * 8 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8, RADDR_SDR, FLEXSPI_1PAD, 0x18), // Block-Erase: D8H, 24bit address
// Pape Program LUTs
[4 * 9 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18), // Page-Program: 02H, 24bit address
[4 * 9 + 1] = FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0), // Write bytes. Stop.
// Erase Chip LUTs
[4 * 11 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xC7, STOP, FLEXSPI_1PAD, 0x0), // Chip-Erase: C7H
},
},
.pageSize = 256u,
.sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = 1u,
.blockSize = 64u * 1024u,
.isUniformBlockSize = false,
};
The MCU is up and running, we can run the test software linked in SRAM using J-link debugger.
J-link downloads the FLASH-located application to the device, but there starts the problems:
- in debugger configuration we select NOT to reset the target before running.
- debugger enters the breakpoint in main and we can step few first calls until we end up to the "deadbeef".
The MCU doesn't boot to the FLASH application after reset.
When running the sligthly modified evkmimxrt1060_flash_component_nor example, we can see that at least the first segment of the application is correctly loaded to the FLASH.
That prooves that writing/ reading of the FLASH interface is working.
Using the tool NXP MCU Boot Utility when selecting Generate unsigned Bootable image, the tool shows up warning "Invalid vector address found in image file: gen\user_file\proto0.srec" but that doesn't actually tell us what's wrong there.
We haven't been able to test application loading via USB since there seems to be some problems with USB connection, still examining the reason.
Any good hints are welcomed, not able to run the application from FLASH really halts our testing efforts.
Any ideas what does the NXP MCU Boot Utility warning mean? Looking at the map file at least the addressees at the beginning of the binary seems to be identical to the one generated from the SDK example.
Thank you in advance,
Jukka
Btw: never really understood how the FlexSPI NOR Device configuration window of the NXP MCU Boot Utility should work: if I select there the Microchip_SST26VFxxxB, nothing changes anywhere, the beginning of the generated binary image in the folder gen\bootable_image still looks the same as they were originally generated by the MCUXpresso.
A bit more information:
We managed to connect to bootloader via UART1 using NXP MCU Boot Utility .
It gives the following information:
--------MCU device Register----------
OCOTP->UUID[31:00] = 0x614ebc87
OCOTP->UUID[63:32] = 0x1d1091d7
SRC->SBMR1 = 0x10
SRC->SBMR2 = 0x1000009
BMOD[1:0] = 2'b01 (Serial Downloader)
HAB status = Open
--------MCU Flashloader info-------
Current Version = K2.1.0
Target Version = T1.0.0
--------MCU device eFusemap--------
(0x450) BOOT_CFG0 = 0x0
(0x460) BOOT_CFG1 = 0x8
(0x470) BOOT_CFG2 = 0x0
BT_FUSE_SEL = 1'b0
When BMOD[1:0] = 2'b00 (Boot From Fuses), It means there is no application in boot device, MCU will enter serial downloader mode directly
When BMOD[1:0] = 2'b10 (Internal Boot), It means MCU will boot application according to both BOOT_CFGx pins and Fuse BOOT_CFGx
----------FlexRAM memory-----------
IOMUXC_GPR->GPR16 = 0x200003
FlexRAM configuration is from eFuse
OCOTP->MISC_CONF0[31:00] = 0x40
FlexRAM Partion =0000 - 128KB ITCM, 128KB DTCM, 256KB OCRAM
--------FlexSPI NOR memory--------
Page Size = --------
Sector Size = --------
Block Size = --------
Problem there seems to be that the FLASH parameters are not read correctly, the command window show the following error:
Executing: D:\tool\NXP-MCUBootUtility-master\tools\blhost2_3\win\blhost -t 50000 -p COM30,115200 -j -- configure-memory 9 538980352
toolStatus: 0
commandOutput: {
"command" : "configure-memory",
"response" : [],
"status" : {
"description" : "20106 (0x4E8A) kStatus_FlexSPINOR_CommandFailure",
"value" : 20106
}
}
Flash read and erase works OK with the tool, but image load fails to an error: "Failed to flash bootable image into external memory, Please reset board and try again!"