QSPI flash erase/write does not work after reading out flash memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QSPI flash erase/write does not work after reading out flash memory

1,413 Views
normanmueller
Contributor I

I use the FRDM-K82F board and try to write to the external NOR-flash via QSPI interface. For the first test I used the driver demo "qspi_polling_transfer". This works fine if I do not modify it, but if I put in code that reads out flash memory via AHB before writeing to it, reprogramming the flash memory does not work anymore. I have no clue why?

 

Here is the code example:

 

void qspi_polling(void)

{

    uint32_t i = 0;

    uint32_t err = 0;

 

    //####### if this code is inserted, erase and program_page does not work #######

    for (i = 0; i < 64; i++)

    {

        PRINTF("The flash value in %d is %x\r\n", i, ((uint32_t *)(FSL_FEATURE_QSPI_AMBA_BASE))[i]);

    }

    //##############################################################################

   

   

    erase_sector(FSL_FEATURE_QSPI_AMBA_BASE);

    PRINTF("Erase finished!\r\n");

 

    /* Program a page */

    program_page(FSL_FEATURE_QSPI_AMBA_BASE, buff);

    PRINTF("Program data finished!\r\n");

 

    for (i = 0; i < 64; i++)

    {

        if (((uint32_t *)(FSL_FEATURE_QSPI_AMBA_BASE))[i] != buff[i])

        {

            PRINTF("The data in %d is wrong!!\r\n", i);

            PRINTF("The flash value in %d is %d\r\n", i, ((uint32_t *)(FSL_FEATURE_QSPI_AMBA_BASE))[i]);

            err++;

        } else {

            PRINTF("The flash value ok in %d is %x\r\n", i, ((uint32_t *)(FSL_FEATURE_QSPI_AMBA_BASE))[i]);

        }

    }

    if (err == 0)

    {

        PRINTF("Program through QSPI polling succeed!\r\n");

    }

}

Labels (1)
0 Kudos
1 Reply

712 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Norman Mueller ,

I apologize for the delay.

Thank you for pointing out this! This bug will be fixed in coming KSDK release.

The LUT table for read command have some errors, which may cause issue in some cases.

The change is very simple, just change the first LUT table contents to

.lookuptable =

        {/* Seq0 :Quad Read */

             /* CMD:        0xEB - Quad Read, Single pad */

             /* ADDR:       0x18 - 24bit address, Quad pads */

             /* DUMMY:      0x06 - 6 clock cyles, Quad pads */

             /* READ:       0x80 - Read 128 bytes, Quad pads */

             /* JUMP_ON_CS: 0 */

             [0] = 0x0A1804EB, [1] = 0x1E800E06, [2] = 0x2400,

I hope this helps.

In case of any issue, please let me know.

Best Regards,

Iva

0 Kudos