1.28.17.4 QSPIx_RegisterWrite Function

C

// x - Instance of the QSPI peripheral

bool QSPIx_RegisterWrite
(
qspi_register_xfer_t *qspi_register_xfer,
uint32_t *tx_data,
uint8_t tx_data_length
);

Summary

Writes to particular register of QSPI slave device.

Description

This function can be used to write to a particular register of QSPI slave device which has a command code associated to it.

Precondition

QSPIx_Initialize must have been called for the associated QSPI instance. Write enable command has to be sent before write register request and

Parameters

Param Description
*qspi_register_xfer pointer to QSPI register transfer structure holding the instructioncode register and instruction frame register information.
*tx_data Pointer to transmit buffer holding the data to write into register.
tx_data_length Register width in bytes.

Returns

  • True on transfer request success.

  • False on transfer request failure.

Example

#define WRITE_STATUS_REG_CODE 0x01
#define QUAD_ENABLE_BIT (1 << 1)

static qspi_register_xfer_t qspi_register_xfer;
static uint8_t reg_data = QUAD_ENABLE_BIT;

qspi_register_xfer.width = QUAD_CMD;

// Write status register of 1 Byte width
qspi_register_xfer.instruction = WRITE_STATUS_REG_CODE;

if (QSPI0_RegisterWrite(&qspi_register_xfer, (uint32_t *)&reg_data, 1) == false)
{
    // Handle Error
}