EasyManuals Logo

Cypress EZ-USB FX3 User Manual

Cypress EZ-USB FX3
660 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #181 background imageLoading...
Page #181 background image
EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 181
Low Performance Peripherals (LPP)
status = CyU3PSpiTransmitWords (buffer, glSpiPageSize);
if (status != CY_U3P_SUCCESS)
{
CyU3PSpiSetSsnLine (CyTrue);
}
CyU3PSpiSetSsnLine (CyTrue);
}
/* Update the parameters */
byteAddress += glSpiPageSize;
buffer += glSpiPageSize;
pageCount --;
CyU3PThreadSleep (10);
}
}
8.5.4 Reads and Writes Using DMA Transfers
A DMA channel (glSpiTxHandle) is created to transfer data to an SPI slave device, and another DMA channel
(glSpiRxHandle) is created to read data from the SPI slave device. Following is the code for performing reads and writes to an
SPI slave using DMA transfers.
CyFxSpiTransfer (uint16_t pageAddress, uint16_t byteCount, uint8_t *buffer, CyBool_t
isRead)
{
CyU3PDmaBuffer_t buf_p;
uint8_t location[4];
uint32_t byteAddress = 0;
uint16_t pageCount = (byteCount / glSpiPageSize);
if ((byteCount % glSpiPageSize) != 0)
{
pageCount ++;
}
buf_p.buffer = buffer;
buf_p.status = 0;
byteAddress = pageAddress * glSpiPageSize;
while (pageCount != 0)
{
location[1] = (byteAddress >> 16) & 0xFF; /* MS byte */
location[2] = (byteAddress >> 8) & 0xFF;
location[3] = byteAddress & 0xFF; /* LS byte */
if (isRead) /* Read */
{
location[0] = 0x03; /* Read command. */
buf_p.size = glSpiPageSize;
buf_p.count = glSpiPageSize;
status = CyFxSpiWaitForStatus ();
CyU3PSpiSetSsnLine (CyFalse);
status = CyU3PSpiTransmitWords (location, 4);
if (status != CY_U3P_SUCCESS)
{

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Cypress EZ-USB FX3 and is the answer not in the manual?

Cypress EZ-USB FX3 Specifications

General IconGeneral
BrandCypress
ModelEZ-USB FX3
CategoryController
LanguageEnglish

Related product manuals