This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

QSPI CINSTR Command Read Multiple Bytes

Hi,

I am trying to read the SFDP (Serial Flash Discovery Parameter) register of a Micron NOR flash memory using nRF52840 QSPI peripheral. The read SFDP register op code is 0x5A, which I send using the CINSTR command. However, the number of bytes in the register is 128. From my understanding, the maximum number of bytes that could be read back using a CINSTR command is 8 bytes. The values are given in this enum:

typedef enum
{
    NRF_QSPI_CINSTR_LEN_1B = QSPI_CINSTRCONF_LENGTH_1B, /**< Send opcode only. value = 0*/
    NRF_QSPI_CINSTR_LEN_2B = QSPI_CINSTRCONF_LENGTH_2B, /**< Send opcode, CINSTRDAT0.BYTE0. value = 1*/
    NRF_QSPI_CINSTR_LEN_3B = QSPI_CINSTRCONF_LENGTH_3B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE1. value = 2*/
    NRF_QSPI_CINSTR_LEN_4B = QSPI_CINSTRCONF_LENGTH_4B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE2. value = 3*/
    NRF_QSPI_CINSTR_LEN_5B = QSPI_CINSTRCONF_LENGTH_5B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT0.BYTE3. value = 4*/
    NRF_QSPI_CINSTR_LEN_6B = QSPI_CINSTRCONF_LENGTH_6B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE4. value = 5*/
    NRF_QSPI_CINSTR_LEN_7B = QSPI_CINSTRCONF_LENGTH_7B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE5. value = 6*/
    NRF_QSPI_CINSTR_LEN_8B = QSPI_CINSTRCONF_LENGTH_8B, /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE6. value = 7*/
    NRF_QSPI_CINSTR_LEN_9B = QSPI_CINSTRCONF_LENGTH_9B  /**< Send opcode, CINSTRDAT0.BYTE0 -> CINSTRDAT1.BYTE7. value = 8*/
} nrf_qspi_cinstr_len_t;
 

At this moment, I can only read 8 bytes of the 128 byte SFDP register. How can I read all of the bytes in the SFDP register using CINSTR, or is there another method?

Thank you,

Lu Tan

Parents Reply Children
  • Thank you, Simon.

    Do I send nrfx_qspi_lfm_start() first or nrfx_qspi_lfm_xfer() first?

    I am thinking

    1.  nrfx_qspi_lfm_start() with opcode and length of 1B.

    2. nrfx_qspi_lfm_xfer() with read buffer of 128 bytes.

    PS: In regards to nrfx_qspi_lfm_xfer(), I am unclear on the final parameter (finalize). It is explained as set "True if custom instruction long frame mode is to be finalized after this transfer." Does this mean set to 1 if the next instruction I want to sent is not long frame and effectively ends long frame mode?

    Best regards,

    Lu Tan

    Edit 1: I just tried to compile the code with the above two functions. I get error that they are undefined?

    II have included nrf_drv_qspi.h. Do these functions belong to another QSPI header?

  • Hi

    The nrfx functions are defined in the nrfx_qspi.h and nrfx_qspi.c files. Please include these and see if you're able to build the project.

    Best regards,

    Simon

  • Hi,

    I was using SDK v15.2.0. Those function are not included in nrfx_qspi.h and nrfx_qspi.c.

    Only in SDK v16.0.0 are those functions included in nrfx_qspi.h and nrfx_qspi.c.

    Are my observations correct or did I miss something about SDK v15.2.0?

    Thanks,

    Lu Tan

Related