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 #186 background imageLoading...
Page #186 background image
EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 186
Low Performance Peripherals (LPP)
FX3 firmware waits for you to enter another character. If you enter 5 then the FX3 firmware can read the first 4 characters
and wait for 3 more characters to be entered on TeraTerm.
CyU3PUartConfig_t uartConfig;
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
/* Initialize the UART for printing debug messages */
apiRetStatus = CyU3PUartInit();
/* Set UART configuration */
CyU3PMemSet ((uint8_t *)&uartConfig, 0, sizeof (uartConfig));
uartConfig.baudRate = CY_U3P_UART_BAUDRATE_115200;
uartConfig.stopBit = CY_U3P_UART_ONE_STOP_BIT;
uartConfig.parity = CY_U3P_UART_NO_PARITY;
uartConfig.txEnable = CyTrue;
uartConfig.rxEnable = CyTrue;
uartConfig.flowCtrl = CyFalse;
uartConfig.isDma = CyTrue;
apiRetStatus = CyU3PUartSetConfig (&uartConfig, uartIntrCb);
/* Set the UART transfer to a really large value. */
apiRetStatus = CyU3PUartTxSetBlockXfer (0xFFFFFFFF);
/* Set the UART transfer to 4 */
apiRetStatus = CyU3PUartRxSetBlockXfer (4);
/* Initialize the debug module. */
apiRetStatus = CyU3PDebugInit (CY_U3P_LPP_SOCKET_UART_CONS, 8);
}
Now you can use the CyU3PDebugPrint API to print debug messages o n Te r a Te r m .
A DMA manual channel needs to be created between the UART producer socket and the CPU consumer socket to get data
into the FX3 from a user interface such as TeraTerm. A minimum-size DMA buffer (16 bytes) is allocated for this data path.
dmaCfg.size = 16;
dmaCfg.count = 1;
dmaCfg.prodSckId = CY_U3P_LPP_SOCKET_UART_PROD;
dmaCfg.consSckId = CY_U3P_CPU_SOCKET_CONS;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
/* Enabling the callback for produce event. */
dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;
dmaCfg.cb = 0;
CyU3PDmaChannelCreate (&glChHandleUARTtoCPU, CY_U3P_DMA_TYPE_MANUAL_IN, &dmaCfg);
CyU3PDmaChannelSetXfer (&glChHandleUARTtoCPU, 0);
The UART callback function definition follows. The firmware needs to check for the RX_DONE event to learn whether the
required number of bytes was received. The DMA channel created for the RX path is wrapped up after receiving the
RX_DONE event. The received data is printed back on the HyperTerminal and the DMA buffer is cleared for receiving the
next set of data from the HyperTerminal.
void uartIntrCb(CyU3PUartEvt_t evt, CyU3PUartError_t error)
{
if (evt == CY_U3P_UART_EVENT_RX_DONE)

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