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.
Hi,
We are trying to use hardware flow control (CTS/RTS) on UART2 to communicate with the other device not to lose any data caused by buffer overrun in burst data transmission.
We thought it was not so difficult thanks to sysconfig, but it did not work as we expected. And, what we did was simply enable "Flow Control" on UART2, then assign CTS/RTS to the specific GPIOs in the PinMux configuration in sysconfig.
As a result, CC2652R7 never stopped transmitting data, even though the peer device set RTS (CTS on CC2652R7) Low.
What we found was that even with this setting on sysconfig, the following code in UART2CC26X2.c driver never enables CTS/RTS correctly.
/* * 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); }
This may be due to the fact that ctsPinMux and rtsPinMux seem to be set correctly in the hardware attributes of ti_drivers_config.c as a result of enabling flow control in sysconfig, but ctsPin and rtsPin are still set to GPIO_INVALID_INDEX, even though we see CONFIG_GPIO_UART2_0_CTS and CONFIG_GPIO_UART2_0_RTS were created in GPIO section.
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 }, };
Also, we've tried to force enable CTS/RTS by calling the following functions regardless of pin settings in UART2 hardware attributes, hardware flow control with the peer device seemed working correctly.
uartEnableCTS(hwAttrs->baseAddr); uartEnableRTS(hwAttrs->baseAddr);
Therefore, we need your help on how to make the hardware flow control of UART2 work correctly without messing up the driver code, but only with the simple configuration on sysconfig.
SDK ver: simplelink CC13xx_CC26xx SDK 5.30.01.01.
Thanks.
Hi NaoU,
Thank you for reporting this issue, I have replicated it from my end as well. I am reporting this behavior to the SysConfig Development Team to be resolved, meanwhile perhaps you can try making the following change in <sdk directory>/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'; % }
Regards,
Ryan