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.
您好!
我们正在尝试使用 UART2上的硬件流控制(CTS/RTS)与另一个器件进行通信、以免因突发数据传输中的缓冲区溢出而丢失任何数据。
我们认为 SysConfig 并不是很困难、但它不像我们预期的那样工作。 我们所做 的就是在 UART2上启用"流控制"、然后将 CTS/RTS 分配给 SysConfig 中 PinMux 配置中的特定 GPIO。
因此、即使对等器件将 RTS (CC2652R7上的 CTS)设置为低电平、CC2652R7也不会停止传输数据。
我们发现、即使在 SysConfig 上使用此设置、UART2CC26X2.c 驱动程序中的以下代码也无法正确启用 CTS/RTS。
/* * If Flow Control is enabled, configure hardware flow control * for CTS and/or RTS. */ if (UART2CC26X2_isFlowControlEnabled(hwAttrs) && (hwAttrs->ctsPin != GPIO_INVALID_INDEX)) { uartEnableCTS(hwAttrs->baseAddr); } else { uartDisableCTS(hwAttrs->baseAddr); } if (UART2CC26X2_isFlowControlEnabled(hwAttrs) && (hwAttrs->rtsPin != GPIO_INVALID_INDEX)) { uartEnableRTS(hwAttrs->baseAddr); } else { uartDisableRTS(hwAttrs->baseAddr); }
这可能是由于在 SysConfig 中启用流控制后、ctsPinMux 和 rtsPinMux 似乎在 ti_drivers_config.c 的硬件属性中正确设置、 但 ctsPin 和 rtsPin 仍然设置为 GPIO_INVALID_INDEX、即使我们看到 CONFIG_GPIO_UART2_0_CTS 和 CONFIG_GPIO_UART2_0_RTS 是在 GPIO 部分创建的。
static const UART2CC26X2_HWAttrs uart2CC26X2HWAttrs[CONFIG_UART2_COUNT] = { { .baseAddr = UART1_BASE, .intNum = INT_UART1_COMB, .intPriority = (~0), .rxPin = CONFIG_GPIO_UART2_0_RX, .txPin = CONFIG_GPIO_UART2_0_TX, .ctsPin = GPIO_INVALID_INDEX, .rtsPin = GPIO_INVALID_INDEX, .flowControl = UART2_FLOWCTRL_HARDWARE, .powerId = PowerCC26XX_PERIPH_UART1, .rxBufPtr = uart2RxRingBuffer0, .rxBufSize = sizeof(uart2RxRingBuffer0), .txBufPtr = uart2TxRingBuffer0, .txBufSize = sizeof(uart2TxRingBuffer0), .txPinMux = IOC_PORT_MCU_UART1_TX, .rxPinMux = IOC_PORT_MCU_UART1_RX, .ctsPinMux = IOC_PORT_MCU_UART1_CTS, .rtsPinMux = IOC_PORT_MCU_UART1_RTS, .dmaTxTableEntryPri = &dmaUart1TxControlTableEntry, .dmaRxTableEntryPri = &dmaUart1RxControlTableEntry, .rxChannelMask = 1 << UDMA_CHAN_UART1_RX, .txChannelMask = 1 << UDMA_CHAN_UART1_TX, .txIntFifoThr = UART2CC26X2_FIFO_THRESHOLD_1_8, .rxIntFifoThr = UART2CC26X2_FIFO_THRESHOLD_4_8 }, };
此外、我们还尝试通过调用以下函数来强制启用 CTS/RTS、而不管 UART2硬件属性中的引脚设置如何、对等器件的硬件流控制似乎工作正常。
uartEnableCTS(hwAttrs->baseAddr); uartEnableRTS(hwAttrs->baseAddr);
因此、我们需要您的帮助、以了解如何使 UART2的硬件流控制正常工作、而不会混淆驱动程序代码、但只能使用 SysConfig 上的简单配置。
SDK 版本:simplelink CC13xx_CC26xx SDK 5.30.01.01。
谢谢。
您好、NaoU、
感谢您报告此问题、我也从我的结尾复制了此问题。 我将此行为报告给 SysConfig 开发团队以待解决、同时您可能可以尝试在中进行以下更改 /source/ti/drivers/.meta/uart2/UART2CC26XX.Board.c.xdt:
% if (inst.flowControl) { /* * Broken code to be removed and replaced with working version % ctsPinName = 'ctsPin' in inst ? inst.ctsPinInstance.$name : 'GPIO_INVALID_INDEX'; % rtsPinName = 'rtsPin' in inst ? inst.rtsPinInstance.$name : 'GPIO_INVALID_INDEX'; */ % ctsPinName = inst.ctsPinInstance.$name; % rtsPinName = inst.rtsPinInstance.$name; % flowName = 'UART2_FLOWCTRL_HARDWARE'; % }
此致、
Ryan
谢谢 Ryan、
我们将在测试结果后通知您。
您好、Ryan、
该解决方案按预期工作。
非常感谢!