This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我的代码可以在没有 DMA 模式的情况下工作、但某个时候会丢失一个字节。 因此、我想使用 DMA 模式来避免数据丢失。
新代码参考示例"C:\ti\mmwave_sdk_03_06_00_00-LTS。\packages\ti\drivers\uart\test\xwr68xx"。
初始化代码:
// let uart b work with tx/rx extern UART_Config UART_config[]; UartSci_HwCfg* hwcfg = (UartSci_HwCfg*) UART_config[1].hwAttrs; hwcfg->duplexity = UartSci_Duplexity_FULL; #if UART_WIFI_USE_DMA DMA_init (); #endif UART_init(); UART_Params_init(&uartParams); uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readDataMode = UART_DATA_BINARY; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readEcho = UART_ECHO_OFF; uartParams.clockFrequency = gFdMCB.cfg.platformCfg.sysClockFrequency; uartParams.baudRate = gFdMCB.cfg.platformCfg.commandBaudRate; uartParams.isPinMuxDone = 1U; uartParams.readTimeout = 50; #if UART_WIFI_USE_DMA DMA_Params dmaParams; DMA_Params_init(&dmaParams); DMA_Handle DMAHandle; DMAHandle = DMA_open(1, &dmaParams, &errCode); if (DMAHandle == NULL) { printf ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode); log_write_fmt ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode); return; } uartParams.dmaHandle = DMAHandle; uartParams.txDMAChannel = 1; uartParams.rxDMAChannel = 2; #endif /* Open the wifi UART Instance: */ UART_Handle uartHandle = UART_open(1, &uartParams); if (uartHandle == NULL) { //System_printf("Error: Unable to open the Wifi UART Instance\n"); log_write("Error: Unable to open the Wifi UART Instance\n"); tvt_debugAssert (0); return; }
我使用 UART_WRITE 和 UART_READ 写入 TX/Rx、并使用 UART A 写入日志。 我可以看到 UART_read 始终返回0、而我的 PC 可以接收来自6843的数据。
当通过
#define uart_WIFI_USE_DMA 0
则代码将正常工作。
您好!
您能提供更多有关您想阅读的内容的背景信息吗? 您的应用是什么? 您的硬件配置是什么? 您是否执行过测试代码或对其进行了全面浏览? 我认为有一些支持 DMA 的 UART 读取和写入示例。 因此、问题很可能是硬件配置不正确或在您的特定实现方案中 UART 驱动程序使用不当。
对于驱动程序测试代码之外的另一个成功示例、我们在雷达工具箱中的演示应用中使用了两个 UART 句柄(开箱即用演示用户指南)。 请参考开箱即用演示源代码中的 main.c。
此致、
卢克