FreeRTOS: UART_SetModemMode does not work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS: UART_SetModemMode does not work

523 Views
falstaff
Senior Contributor I

Hello,

Using the latest FreeRTOS iMX7D 1.0.1 BSP I am not able to use the UART in DTE. I use the hello_world example and changed harware_init.c trying to switch to DCE mode using UART_SetModemMode with the uartModemModeDte argument. Unfortunately that seems not to work.

Best regards,

Stefan

Labels (2)
Tags (2)
0 Kudos
1 Reply

414 Views
falstaff
Senior Contributor I

After further debugging it turns out that the implementation in uart_imx.c contains a bug in the assertion of the argument. This change helped to fix the issue:

diff --git a/platform/drivers/src/uart_imx.c b/platform/drivers/src/uart_imx.c
index 3c5149d..f86d559 100644
--- a/platform/drivers/src/uart_imx.c
+++ b/platform/drivers/src/uart_imx.c
@@ -389,7 +389,7 @@ void UART_SetCtsPinLevel(UART_Type* base, bool active)
 *END**************************************************************************/
 void UART_SetModemMode(UART_Type* base, uint32_t mode)
 {
- assert((uartModemModeDce & uartModemModeDce) || (uartModemModeDce & uartModemModeDte));
+ assert((mode == uartModemModeDce) || (mode == uartModemModeDte));
 if (uartModemModeDce == mode)
 UART_UFCR_REG(base) &= ~UART_UFCR_DCEDTE_MASK;
 else

Since the issue is in the driver code provided by NXP, it would be nice if this issue will be fixed in the next FreeRTOS BSP release...