Quad SPI flash support on MCUXpresso IDE v10.1.1 for the iMX.RT1050?

cancel
Showing results for 
Search instead for 
Did you mean: 

Quad SPI flash support on MCUXpresso IDE v10.1.1 for the iMX.RT1050?

1,583 Views
Contributor III

Hello MCUXpresso IDE community,

We are trying to start an iMX.RT1050 project currently on the MIMXRT1050-EVK with MCUXpresso IDE v10.1.1 that we would like to build and test in debug mode. Up to now we worked with the standard MIMXRT1050-EVK using the on-board hyperflash.

Setting SW7 to 0.1.1.0 and selecting the flash driver MIMXRT1050-EVK_S26KS512S.cfx worked well for running SDK XiP flash based examples in debug mode using a DAPLink probe.

After removing the hyperflash part from the MIMXRT1050-EVK, replacing the standard quad spi flash component on the MIMXRT1050-EVK with a S25FL256SAGBFI313 quad spi flash, adding appropriate 0 ohm resistors and setting SW7 to 0.0.1.0 I tried to run the same SDK example in debug mode, however I got part recognition errors after selecting the DAPLink probe:

Failed to read address register in DAP - Ee(FF). Redlink interface error 255.
flash driver polled mailbox (8 bytes at 0x2000B728) read failed (on poll 1/301) - retrying after 1ms - rc Em(17). Debug port inaccessible after access at location 0x2000B728
After error Nn(05). Wire ACK Fault in DAP access -
Failed to read address register in DAP - Ee(FF). Redlink interface error 255.
flash driver polled mailbox (8 bytes at 0x2000B728) read failed (on poll 1/301) - halting for postmortem - rc Em(17). Debug port inaccessible after access at location 0x2000B728
failed to halt target for postmortem - rc Em(17). Debug port inaccessible after access at location 0x2000B728
failed to read registers - Ep(08). Cannot access core regs when target running.
Flash Driver V.2 startup failed - rc Em(17). Debug port inaccessible after access at location 0x2000B728
chip initialization failed - Em(17). Debug port inaccessible after access at location 0x2000B728
failed to find a target memory area to use to test the Debug Access Port
required information about vendor NXP chip MIMXRT1052xxxxx not found
Failed on chip setup: Ec(01). Invalid part, XML, or configuration.
error closing down debug session - Ee(FF). Redlink interface error 255.

 

This set of errors is repeated for the LPC5460x_SPIFI_GENERIC.cfx flash driver selection. Consensus among our team is that we are missing a driver for MCUXpresso IDE 10.1.1 to support the S25FL256SAGBFI313 component which we intend to use in our design.

Are there any plans for MCUXpresso IDE to upgrade its flash drivers to support the S25FL256S part? If not is there a set of generic drivers that can be adapted to work with this part for debug sessions via MCUXpresso IDE?

7 Replies

50 Views
Contributor III

Hi Ed, we had the same problem like you.

First we also used the Hyperlash, but wanted to use the much cheaper QSPI Flash.

Our main problem was that the lookup table was incorrect and so the QSPI Flash was only programmable once. (Than I had to erase it on another board).

If you have a look in the datasheet at Table 8-15. "LUT sequence definition for Serial NOR" you will find how to set up the LUT correctly. You can find the lookuptable in file fsl_flexspi_nor_flash.c.

Since I had done this I can execute the programm code and also reprogram the Flash without problems.

Here is my code:

const flexspi_nor_config_t hyperflash_config =
{
    .memConfig =
    {
        .tag = FLEXSPI_CFG_BLK_TAG,
        .version = FLEXSPI_CFG_BLK_VERSION,
        .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromSckPad,
        .csHoldTime = 3u,
        .csSetupTime = 3u,
        .columnAddressWidth = 0u,
        // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock
//        .controllerMiscOption = (1u << kFlexSpiMiscOffset_DdrModeEnable) |
//                                (1u << kFlexSpiMiscOffset_WordAddressableEnable) |
//                                (1u << kFlexSpiMiscOffset_SafeConfigFreqEnable) |
//                                (1u << kFlexSpiMiscOffset_DiffClkEnable),
                .deviceType = kFlexSpiDeviceType_SerialNOR,
        .sflashPadType = kSerialFlash_4Pads,
        .serialClkFreq = kFlexSpiSerialClk_50MHz,
        .sflashA1Size = 8u * 1024u * 1024u,
        .dataValidTime = {16u, 16u},
        .lookupTable =
            {
                            //0
                            //Fast read Quad IO DTR Mode Operation in SPI Mode (normal read)
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xED, RADDR_DDR, FLEXSPI_4PAD, 0x18),
                FLEXSPI_LUT_SEQ(DUMMY_DDR, FLEXSPI_4PAD, 0x0C, READ_DDR, FLEXSPI_4PAD, 0x08),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            //1
                            //Read Status
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x1),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            //2
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //3
                            //Write Enable
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            //4
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //5
                            //Erase Sector------------------
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD7, RADDR_SDR, FLEXSPI_1PAD, 0x18),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            //6
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //7
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //8
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //9
                            //Page Program
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18),
                FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x8, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            //10
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            0x00000000,
                            
                            //11
                            //Chip Erase
                                FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xC7, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
                FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),

                            

                        },
    },
    .pageSize = 256u,
    .sectorSize = 4u * 1024u,
    .blockSize = 32u * 1024u,
    .isUniformBlockSize = true,
};

Please let me know if I could help you.

Regards

Martin

50 Views
Contributor III

Hi Martin,

How did you program the qspi flash...? Did you use the mfgtool or any other method..?

0 Kudos

50 Views
Contributor III

Hi Twinkle,

I use Keil MDK to program the flash. After using the correct Lookuptable (see above), there wasn't any problem to program the QSPI Flash.

50 Views
Senior Contributor I

Hello Martin

Can you please explain why the spinor c code helped with this issue?

As far as I understand, the driver inMCUXpresso is used for erasing and programming from MCUXpresso IDE. And the c code is used for the application initialization during aaplication boot only .

So how is it that the c code which is relared to boot is helpful with the programming from MCUXpresso?

Or is it that you actally program the code from application( but I guess this is not what you are doing)

There is something here which I do not inderstand

When using MCUXpresso is the interface being initialized with the header from the already programmed application or is it initialized with the driver in mcuxpresso ide?

Thank you

Ran

0 Kudos

50 Views
Contributor III

Hi Martin,

Thanks for your feedback. This is good insight in changing our flash driver for our project to run correctly after loading. I see the RM section 8.6.4 specifying the serial NOR and NAND config based on FlexSPI i/f. I will apply these to our project however the base issue of driver support for loading via MCUXpresso IDE into debug mode remains. For this it is my understanding that we will need to either wait for a driver from the MCUXpresso team (something like the MIMXRT1050-EVK_S26KS512S.cfx but for quad spi flash, not hyperflash) or make one ourselves.

-Ed.

0 Kudos

50 Views
NXP Employee
NXP Employee

Sorry we don't currently have any support for Quad SPI devices on the i.MX RT 1050, only Hyperflash. And you certainly can't use the driver for the LPC546xx family - the LPC parts are very very different to the i.MX RTs !

Producing a Quad SPI driver for i.MX RT 1050 is certainly on our Todo list, but I can't give you a timescale currently I'm afraid.

Regards,

MCUXpresso IDE Support

0 Kudos

50 Views
Contributor III

Thanks for your reply. We realized that the LPC5460X project was included along with sources for LPCOpen and SPIFI library generic driver implementation. Taking your point that the driver customization is not meant for the i.MX.RT1050 platform, I was curious if you can make the project and sources used to build the MIMXRT1050-EVK_S26KS512S.cfx available for customizing/converting hyperflash to quad spi flash. Perhaps I'm oversimplifying the effort needed, but in the absence of a ready built driver we have someone on our team that is willing to try.

0 Kudos