FreeRTOS: UART_SetModemMode does not work

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FreeRTOS: UART_SetModemMode does not work

707 次查看
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

标签 (2)
标记 (2)
0 项奖励
回复
1 回复

598 次查看
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...