How to implement CDC to UART bridge on FX3 (i.e. cyfxusbuart example) without CTS/RTS handshake?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
IzMa_4105896
Level 2
Level 2
10 replies posted 5 replies posted 5 questions asked

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);

}

}

0 Likes
1 Solution

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

View solution in original post

0 Likes
3 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

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

0 Likes

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

0 Likes

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

0 Likes