- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to implement a CDC to UART bridge similar to the cyusbuart example working but without hardware handshake (no CTS/RTS). The cyusbuart example depends on CTS/RTS handshake to disable data into the UART when transferring partial messages that do not fill the entire DMA buffer to the USB (see code from example below). How to do get this same functionality without the CTS/RTS handshake?
Thanks,
Iztok
/* Entry function for the USBUARTAppThread */
void
USBUARTAppThread_Entry (
uint32_t input)
{
uint32_t regValueEn = 0, regValueDs = 0;
/* Initialize the USBUART Example Application */
CyFxUSBUARTAppInit();
/* UART Config Value for Enabling Rx Block */
regValueEn = UART->lpp_uart_config;
/* UART Config Value for Disabling the Rx Block */
regValueDs = UART->lpp_uart_config & (~(CY_U3P_LPP_UART_RTS | CY_U3P_LPP_UART_RX_ENABLE));
for (;;)
{
if (glIsApplnActive)
{
/* While the application is active, check for data sent during the last 50 ms. If no data
has been sent to the host, use the channel wrap-up feature to send any partial buffer to
the USB host.
*/
if (glPktsPending == 0)
{
/* Disable UART Receiver Block */
UART->lpp_uart_config = regValueDs;
CyU3PDmaChannelSetWrapUp (&glChHandleUarttoUsb);
/* Enable UART Receiver Block */
UART->lpp_uart_config = regValueEn;
}
glPktsPending = 0;
}
CyU3PThreadSleep (50);
}
}
Solved! Go to Solution.
- Tags:
- uart bridge
- uart dma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Iztok,
It seems that the register-based UART transfer can be a correct way for this issue.
You can try implementing cyuartlpregmode example found in along with the FX3 SDK.
Regards,
Yashwant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It is possible to disable the RTS/CTS handshake but it is not recommended as there are two main problems associated with it:
1.) When all the buffers of the UART block are full, there is no way to tell the transmitter to stop sending leading to data loss.
2.) When there is a partial buffer, it will not get committed automatically until the buffer is full(to commit the partial buffer in the firmware, we use CyU3PDmaChannelSetWrapUp() to commit it and while doing so, the transmitter is notified not to send any data the receiver block is disabled).
Regards,
Yashwant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my case there are no physical RTS/CTS handshake lines on the hardware. The messages to/from the UART are small (<16 bytes) at 115200 baud. After digging around the examples and documentation it seems that register-based UART transfers might be the correct way to go. Please advise.
Thanks,
Iztok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Iztok,
It seems that the register-based UART transfer can be a correct way for this issue.
You can try implementing cyuartlpregmode example found in along with the FX3 SDK.
Regards,
Yashwant