I am developing an application on top of the Industrial Toolbox 4.12.1 Overhead 3D People Counting lab and have a few questions.
I have UART 1 & 3 configured with both RX & TX lines as follows:
/* Setup the PINMUX to bring out the UART-1 */ Pinmux_Set_FuncSel(SOC_XWR68XX_PINN5_PADBE, SOC_XWR68XX_PINN5_PADBE_MSS_UARTA_TX); Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINN5_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL); Pinmux_Set_FuncSel(SOC_XWR68XX_PINN4_PADBD, SOC_XWR68XX_PINN4_PADBD_MSS_UARTA_RX); Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINN4_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL); /* Setup the PINMUX to bring out the MSS UART-3 */ Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINF14_PADAJ, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL); Pinmux_Set_FuncSel(SOC_XWR68XX_PINF14_PADAJ, SOC_XWR68XX_PINF14_PADAJ_MSS_UARTB_TX); Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINP4_PADBB, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL); Pinmux_Set_FuncSel(SOC_XWR68XX_PINP4_PADBB, SOC_XWR68XX_PINP4_PADBB_MSS_UARTB_RX);
I am testing the following on UART-3 @ 115k baudrate.
When I have 2 back-to-back UART_write calls (without DMA), it seems that the buffer is overwritten by the second call, which causes malformed data being received on the PC. What causes this issue? The driver documentation mentions that UART_write is blocking. Therefore, I would expect the first call to block until all data has been written, and then the second call should be executed.
However, if I change all UART_writes to UART_writePolling, it seems to fix the issue.
If I add a sleep(20) between the two UART_writes, that fixes it too (unless I am transmitting a really large packet, in which case I see some overwrites depending on the packet size).
Lastly, if I use DMA with UART_write, that mostly fixes the issue, but causes a few corrupted packets.
Further, I am facing some application specific issues when I enable DMA on UART-3 and use UART_write. I don't expect a direct resolution on this since I'm unable to share the code now. However, I want to understand if there are any foreseeable issues that I could encounter when I enable DMA on UART-3 for both RX & TX, and if I should be aware of any caveats?