1.8.15.5 QSPIx_MemoryRead Function

C

// x - Instance of the QSPI peripheral

bool QSPIx_MemoryRead
(
qspi_memory_xfer_t *qspi_memory_xfer,
uint32_t *rx_data,
uint32_t rx_data_length,
uint32_t address
);

Summary

Reads from the specified address of the serial flash device.

Description

This function can be used to read n bytes of data from the specified address of the serial flash device connected as a QSPI slave.

Precondition

QSPIx_Initialize must have been called for the associated QSPI instance.

Parameters

Param Description
*qspi_memory_xfer pointer to QSPI memory transfer structure holding the instructioncode register and instruction frame register information.
*rx_data Pointer to receive buffer where the data read from memory will be stored.
rx_data_length number of bytes to read.
address Memory location to read from.

Returns

  • True on transfer request success.

  • False on transfer request failure.

Example

#define READ_MEMORY_CODE 0x0B

static qspi_memory_xfer_t qspi_memory_xfer;
static uint32_t buffer[4];
uint32_t address = 0x0

// Read memory location starting from address 0x0
qspi_memory_xfer.instruction = READ_MEMORY_CODE;

// Use QAUD SPI Lane
qspi_memory_xfer.width = QUAD_CMD;
qspi_memory_xfer.dummy_cycles = 6;

if (QSPI0_MemoryRead(&qspi_memory_xfer, buffer, sizeof(buffer), address) == false)
{
    // Handle Error
}