NetBurner 3.5.0
PDF Version |
|
Topics | |
QSPI state | |
Classes | |
struct | QSPI_Record |
This struct contains the major variables/configurations used for a QSPI transfer. More... | |
Functions | |
uint8_t | QSPIInit (uint32_t baudRateInBps=2000000, uint8_t transferSizeInBits=8, uint8_t peripheralChipSelects=0x0F, uint8_t chipSelectPolarity=1, uint8_t clockPolarity=0, uint8_t clockPhase=1, BOOL doutHiz=TRUE, uint8_t csToClockDelay=0, uint8_t delayAfterTransfer=0) |
Initialize Queued Serial Peripheral Interface (QSPI) | |
uint8_t | QSPIStart (puint8_t transmitBufferPtr, volatile uint8_t *receiveBufferPtr, uint32_t byteCount, OS_SEM *finishedSem=NULL) |
Start QSPI Data Transfer. | |
BOOL | QSPIdone (void) |
Can be called after QSPIStart(). Returns TRUE when transfer is complete. This is an alternative to using a semaphore. | |
#include< qspi.h >
Supported platforms:
Introduction
The Queued Serial Peripheral Interface (QSPI) is a full duplex synchronous serial data link that operates in master/slave mode. The QSPI is similar to SPI, but also provided a hardware queue for transmit data, receive data, and commands. Up to 16 transfers can be queued at one time, eliminating CPU intervention between transfers. The NetBurner QSPI driver and API provide interrupt driven QSPI communication.
The QSPI specification allows for sharing the QSPI bus with multiple devices. However, when designing your system you must consider what devices are connected and the desired throughput. For example, if you are using the Embedded Flash File System (EFFS) with external SD flash cards, or the WiFi module, they will require exclusive use of the QSPI.
The QSPI uses the following hardware signals:
Programming tip: If you are new to QSPI and require a chip select for your device, we recommend using a GPIO signal during initial development to simplify your application code. Once proper operation has been achieved, modify the code to use the QSPI chip selects.
QSPI Configuration and Initialization
Use of the QSPI requires:
|
inline |
#include <qspi.h>
Can be called after QSPIStart(). Returns TRUE when transfer is complete. This is an alternative to using a semaphore.
TRUE | When transfer is complete |
FALSE | On error |
Can be called after QSPIStart(). Returns TRUE when transfer is complete. This is an alternative to using a semaphore.
Note that the 'Q' stands for Queued SPI
|
inline |
#include <qspi.h>
Initialize Queued Serial Peripheral Interface (QSPI)
Notes: (3) Transfers > 8 must be word aligned (4) Select based on chipSelectPolarity (5) 0 data captured leading edge of QSPI_CLK, changed following edge. (6) 1 data changed leading edge of QSPI_CLK, captured following edge. (7) 0 default is 1/2 QSPI_CLK or see MFCXXXX reference manual (8) 0 default is 8192/(system clock / 2) see MFCXXXX reference manual
baudRateInBps | Maximum requested baud rate in bits per second. The maximum possible baud rate is determined by the system clock. The function will select the highest possible baud rate if the specified value cannot be achieved. |
transferSizeInBits | Size of data values to be transferred. Values can be 8, 16 or 32 bits. Note that 16 and 32 bit size values must be word (16-bit) aligned (16-bit). |
peripheralChipSelects | Peripheral chip select drive level. Used to select an external device for serial data transfer. More than one chip select may be active at once, and more than one device can be connected to each chip select. Bits 3-0 map directly to QSPI_CS[3:0], respectively. For each bit:
|
chipSelectPolarity | Peripheral chip select inactive level (no transfer in progress). Applies to all chip selects.
|
clockPolarity | Clock polarity:
|
clockPhase | Clock phase:
|
doutHiz | Data output high impedance enable. Selects QSPI_DOUT mode of operation.
|
csToClockDelay | QCD, QSPICLK delay. When the DSCK bit in the command RAM is set this field determines the length of the delay from assertion of the chip selects to valid QSPI_CLK transition. |
delayAfterTransfer | Delay after transfer. When the DT bit in the command RAM is set this field determines the length of delay after the serial transfer. |
Initialize Queued Serial Peripheral Interface (QSPI)
Note that the 'Q' stands for Queued SPI
Will use the default SPI module, 0.
baudRateInBps | Maximum baud rate requested |
transferSizeInBits | Number of bits per transfer: 8, 16 or 32 |
peripheralChipSelects | SPI chip selects to use for transfer |
chipSelectPolarity | 0 = inactive logic level low, 1 = high |
clockPolarity | 0 = inactive logic level low, 1 = high |
clockPhase | 0 = data captured leading edge clock, changed following edge. 1 = data changed leading edge clock, captured following edge. |
doutHiz | Data output high impedance between transfers |
csToClockDelay | Delay from chip select to valid clock (default is 0) |
delayAfterTransfer | Chip select mode spiChipSelect |
|
inline |
#include <qspi.h>
Start QSPI Data Transfer.
transmitBufferPtr | Pointer to the buffer to use in the transfer. Specify NULL for receive only. |
receiveBufferPtr | Pointer to buffer to store received data. NULL for transmit only. |
byteCount | Number of bytes to send or receive. If the data size is greater than 8-bit, you must provide the total number of bytes. |
finishedSem | Pointer to preinitialized semaphore to post to when transfer is complete. A value of NULL disables the semaphore function. |
Start QSPI Data Transfer.
Note that the 'Q' stands for Queued SPI
transmitBufferPtr | Pointer to the buffer containing the data to transmit |
receiveBufferPtr | Pointer to the buffer to store the received data |
byteCount | Number of bytes to transmit |
finishedSem | Optional semaphore to post to when finished |