S25FL128S Unable to set Quad Mode on NXP/Feescale Kinetis

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DeCo_3479626
Level 1
Level 1

I am "fsl_qspi" drivers from NXP's SDK, and can read and write using Dual-IO DDR.  However, I am unable to set the Quad mode bit in the Configuration Register, and need to make sure that I'm not missing anything:

#ifdef BOARD_QSPI_DEVICE_S25FL128S  // Cypress S25FL128S

#  if (QSPI_DEFAULT_READ_COMMAND_SEQUENCE & QSPI_READ_WIDTH_MASK) == QSPI_READ_WIDTH_4 // Quad mode

// Clear the FIFO

QSPI_ClearFifo(BOARD_QSPI_BASE, kQSPI_TxFifo);

// Set the address (Driver wants base address for register writes,

// but this is not sent in the Write Register Sequence

QSPI_SetIPCommandAddress(BOARD_QSPI_BASE, FSL_FEATURE_QSPI_AMBA_BASE);

// Send WREN (Should be OK - works in single/dual mode)

cmd_write_enable();

/*

Command Sequence:

0x01 - WRR

0x02 - Status Register (bit 1 is not really settable like this, but there's no harm sending it)

0x02 - Config Register (bit 1 = Quad Enable )

*/

// Send WRR

QSPI_ExecuteIPCommand(BOARD_QSPI_BASE, QSPI_LUT_SEQ_WRITE_REGISTER);

// Load Tx data FIFO - need push at least 16 bytes before it will pop

// Note that the transmitter will only send the first 2 bytes 0x02, 0x02

for (int i=0; i<4; i++)

{

QSPI_WriteData(BOARD_QSPI_BASE, (uint32_t)0x02020202);

}

while (QSPI_GetStatusFlags(BOARD_QSPI_BASE) & kQSPI_Busy)

{

}

#  endif

#endif

0 Likes
1 Solution
DeCo_3479626
Level 1
Level 1

Okay, I've answered my own question:

The driver function QSPI_GetStatusFlags() only checks if the MCU's QSPI device, and not the external flash.  So the Cypress part may still have been busy when subsequent commands were sent.  Simply added a fixed delay to allow the flash operation to end, and everything worked.  The fixed delay was just to be safe:  I was wary of reading the Status Register to get the WIP bit, while busy writing the same register

    while (QSPI_GetStatusFlags(BOARD_QSPI_BASE) & kQSPI_Busy)

    {

    }

//  Add a primitive delay for the flash op to end

//  (not reading WIP bit, just to be safe)

    for (int i = 0; i < 400; i++)

    {

        __ASM("nop");

    }

View solution in original post

0 Likes
2 Replies
DeCo_3479626
Level 1
Level 1

Okay, I've answered my own question:

The driver function QSPI_GetStatusFlags() only checks if the MCU's QSPI device, and not the external flash.  So the Cypress part may still have been busy when subsequent commands were sent.  Simply added a fixed delay to allow the flash operation to end, and everything worked.  The fixed delay was just to be safe:  I was wary of reading the Status Register to get the WIP bit, while busy writing the same register

    while (QSPI_GetStatusFlags(BOARD_QSPI_BASE) & kQSPI_Busy)

    {

    }

//  Add a primitive delay for the flash op to end

//  (not reading WIP bit, just to be safe)

    for (int i = 0; i < 400; i++)

    {

        __ASM("nop");

    }

0 Likes

Hello Denis,

Thank you for the update. Great to know that issue is resolved.

Have a wonderful day,

Regards,

Bushra

0 Likes