S7G2 QSPI MT25QL256 work only one time

Hello,

I am working to enable a QSPI, I work on the DKS7G2 my QSPI is a micron MT25QL256ABA8ESF-0SIT, it is the evolution of the deprecated DK QSPI.

I work with a custom QSPI board on pin headers and QSPI switch on the DK board OFF (so the on board QSPI is disabled)

The program is the demo software : bsp_qspi_init (commands are the same for my MT25 and bsp onboard N25) then it writes some datas. It reads datas and tests them to blink a led. Demo works well with onboard N25, but it only works one time with the MT25 : the first start is ok led blink, and all the next start QSPI is not initialized (bad IDs 0xFFFFFF). I used 3 custom daughter boards with MT25 and I had the same result.

Any idea why I can't use my QSPI more than one time ?

Regards,

  • Hi TLHQ,

    By saying 'one time' you mean the first time after a power source is supplied? Seems like this chip requires reset, does the manual say something about this?

    Regards,
    adboc
  • In reply to adboc:

    How are you configuring the device, are you writing to the volatile or non volatile configuration register? To read the manufacturer ID, the device will have to be taken out of XIP mode first.
  • In reply to Jeremy:

    Hello,

    Thanks you two for your help,

    For this test I use a daughter board. I connect the QSPI board to the pins on the DKS7G2. I have tested 3 boards (all the same QSPI reference) the code works the first time DK board is powered and code executed yes.

    The program initialize QSPI, write some values in it and read those values, a led is turned on and off with certain values

    When I turn the DK board off and on again led is not blinking any more => QSPI is not working => debugger shows that readID read bad IDs.

    here is the init code to readID :

        /* Initialized unused bits */
        R_QSPI->SFMSPC = 0x10;
        R_QSPI->SFMCST = 0U;
        R_QSPI->SFMSIC = 0U;
        R_QSPI->SFMPMD = 0U;

        /* enable clocks to the QSPI block */
        R_MSTP->MSTPCRB_b.MSTPB6 = 0U;

        /* Set the SPI clock rate */
        R_QSPI->SFMSKC_b.SFMDV = BSP_PRV_QSPI_CLOCK_RATE; // QSPI_CLK_60MHZ with PCLKA 120Mhz

        /* enter direct communication mode */
        R_QSPI->SFMCMD_b.DCOM = 1U;

        /* Reset the flash device. */
        R_QSPI->SFMCOM        = 0x66; /* Write the command */
        R_QSPI->SFMCMD_b.DCOM = 1;                         /* Close the SPI bus cycle */
        R_QSPI->SFMCOM        = 0x99; /* Write the command */
        R_QSPI->SFMCMD_b.DCOM = 1;

        /* Read the ID of the device. Confirm it is the correct device. */
        R_QSPI->SFMCOM                         = 0x9F;  /* Write the command */
        device_characteristics.manufacturer_id = R_QSPI->SFMCOM_b.SFMD; /* Read the manufacturer ID */
        device_characteristics.memory_type     = R_QSPI->SFMCOM_b.SFMD; /* Read the memory type */
        device_characteristics.memory_capacity = R_QSPI->SFMCOM_b.SFMD; /* Read the memory capacity */
        R_QSPI->SFMCMD_b.DCOM                  = 1U;                    /* Close the SPI bus cycle */

        if ((0x20 != device_characteristics.manufacturer_id) ||
            (0xBA != device_characteristics.memory_type) ||
            (0x19 != device_characteristics.memory_capacity))
        {
            device_characteristics.manufacturer_id = 0UL;
            device_characteristics.memory_type     = 0UL;
            device_characteristics.memory_capacity = 0UL;
            return; // it only works the first time, after program leave here because readID = 0xFFFFFF != 0x20BA19
        }

  • In reply to TLHQ:

    I think what is happening is that the device is still in XIP mode when the board is reset (is XIP mode set in the Non-volatile register, or volatile register?????), the sequence :-

       /* Reset the flash device. */

       R_QSPI->SFMCOM        = 0x66; /* Write the command */

       R_QSPI->SFMCMD_b.DCOM = 1;                         /* Close the SPI bus cycle */

       R_QSPI->SFMCOM        = 0x99; /* Write the command */

       R_QSPI->SFMCMD_b.DCOM = 1;

    may not take the QSPI device out of XIP mode. If you read the MT25QL256ABA8ESF-0SIT datasheet, for the reset commands :-

     

     

    "It is reccomended to exit XIP mode before executing these two commands".

     

    To exit XIP mode you need to send the Xb bit in the dummy cycles as 1 to exit XIP mode and return to standard read mode :-

     

    So, you could send 2 bytes before the reset sequence, that set the Xb bit to 1 to exit XIP mode, then send the reset commands, e.g. :-

       /* Take the device out of XIP mode */

       R_QSPI->SFMCOM        = 0x66; /* Reset enable command, just dummy data */

     R_QSPI->SFMCOM        = 0xFF; /* set the Xb bit to 1 to take the QSPI device out of XIP mode, set all bit to 1 */

       R_QSPI->SFMCMD_b.DCOM = 1;                         /* Close the SPI bus cycle */

    Then send the reset sequence:-

       /* Reset the flash device. */

       R_QSPI->SFMCOM        = 0x66; /* Write the command */

       R_QSPI->SFMCMD_b.DCOM = 1;                         /* Close the SPI bus cycle */

       R_QSPI->SFMCOM        = 0x99; /* Write the command */

       R_QSPI->SFMCMD_b.DCOM = 1;

     

    Also, in the code you posted, the writes to the QSPI peripheral before it is taken out of module stop will do anything :-

        /* Initialized unused bits */
        R_QSPI->SFMSPC = 0x10;
        R_QSPI->SFMCST = 0U;
        R_QSPI->SFMSIC = 0U;
        R_QSPI->SFMPMD = 0U;

        /* enable clocks to the QSPI block */
        R_MSTP->MSTPCRB_b.MSTPB6 = 0U;

     

    The order should be switched :-

        /* enable clocks to the QSPI block */
        R_MSTP->MSTPCRB_b.MSTPB6 = 0U;

        /* Initialized unused bits */
        R_QSPI->SFMSPC = 0x10;
        R_QSPI->SFMCST = 0U;
        R_QSPI->SFMSIC = 0U;
        R_QSPI->SFMPMD = 0U;

     

  • In reply to Jeremy:

    Hello Jeremy,
    thanks you for your detailled answer !
    I tried with the modifications you provided and it doesn't work.
    I tried to exit xip before or after opening direct communication with no result.
    I checked XIP mode is written in volatile configuration.
    Thanks you for helping i am really lost with this issue,
    Regards,
  • In reply to TLHQ:

    Hi TLHQ,

    I think this resource can be useful: www.micron.com/.../8792d3da-69ec-4794-8399-53dceaa69660

    Regards,
    adboc
  • In reply to adboc:

    Hi adboc,

    thanks you,

    yes I have this document, I've read TN2533_migrating_n25q_lowden_to_mt25q / TN1229_n25q_n25w_reset_configs / TN2501_migrating_n25q_to_mt25ql / N25Q datasheet and MT25Q datasheet.

    If my understanding is correct (it doesn't work so I think I miss something) my initialization sequence should work (I have a small hard reset circuit on power up and the soft reset should be ok to readID). I decided to request some help on the forum to get an external point of view as I don't understand what is happening with the QSPI.

    I read again the manuals and I saw this : Reset sequence for all XIP configuration so I tried to send 0xFF 14 times with a loop before sending 0x66 and 0x99 but it didn't work.

    Best regards,

  • In reply to TLHQ:

    Hi TLHQ,

    I think you may ask chip's manufacturer for further support. They should know how to initialize this QSPI chip.

    Regards,
    adboc
  • In reply to adboc:

    Hi ,

    Have you managed to make this chip working on Synergy? Could you share instructions how to properly initialize it?

    Thanks,
    adboc
  • In reply to adboc:

    Hi,
    yes I have something working. I don't know exactly why but I have "killed" some QSPI with my first files. As I remember I have modified the bsp_qspi.h commands and I have disable XIP mode on startup in bsp_qspi.c
    Regards,
  • In reply to TLHQ:

    Hi ,
    If allowed, could you post the initialization code on here on how to turn off XIP mode? Running into a similar issue, I believe. Thank you!
    -Jake