1.42.12.7 QSPIx_TransferSetup Function

C

The prototype of QSPIx_TransferSetup() varies based on device family. Refer to the generated header file for the actual prototype to be used.

// x - Instance of the QSPI peripheral

bool QSPIx_TransferSetup(QSPI_TRANSFER_SETUP *setup, uint32_t spiSourceClock);

bool QSPIx_TransferSetup(QSPI_TRANSFER_SETUP *setup);

Summary

Setup QSPI operational parameters as desired by the client. This is used in SPI mode only.

Description

This function setup SPI x with the values needed by the client dynamically. Values passed through setup structure will be the new setup for SPI transmission. Even if user is not intending to modify all the setup parameters, he must update his setup structure with all its parameters.

If user do not update all the setup structure elements, then unexpected SPI behavior may occur. User need not call this function if he has configured the setup in GUI and there is no dynamic change needed in any of the parameters.

Precondition

QSPI must first be initialized using QSPIx_Initialize().

Parameters

Param Description
*setup pointer to the data structure of type QSPI_TRANSFER_SETUP which has thelist of elements to be setup for a client.
spiSourceClock Source Clock frequency in Hz on which QSPI module is running.

Returns

  • true: if setup was successful

  • false: if qspiSourceClock and QSPI clock frequencies are such that resultant SCBR value is out of the possible range

Example

QSPI_TRANSFER_SETUP setup;
setup.clockFrequency = 1000000;
setup.clockPhase = QSPI_CLOCK_PHASE_TRAILING_EDGE;
setup.clockPolarity = QSPI_CLOCK_POLARITY_IDLE_LOW;
setup.dataBits = QSPI_DATA_BITS_8;

// Assuming 150 MHz as peripheral Master clock frequency
if (QSPI0_TransferSetup(&setup, 150000000) == false)
{
    // this means setup could not be done, debug the reason.
}
QSPI_TRANSFER_SETUP setup;
setup.clockPhase = QSPI_CLOCK_PHASE_TRAILING_EDGE;
setup.clockPolarity = QSPI_CLOCK_POLARITY_IDLE_LOW;
setup.dataBits = QSPI_DATA_BITS_8;

// Assuming 150 MHz as peripheral Master clock frequency
if (QSPI0_TransferSetup(&setup) == false)
{
    // this means setup could not be done, debug the reason.
}

Remarks

User need not call this function if he has configured the setup in GUI and there is no dynamic change needed in any of the parameters.