Part Number:CC2541
Hello to everyone,
while developing with the CC2541 I stumbled across a weird behaviour I couldn't explain and therefore couldn't prevent. It feels like I'm missing something here:
Setup:
The CC2541 is connected to a Host via UART with activated HW flow control. BLE is running all the time and advertises, connects, etc.
The connected Host has an UART RX Buffer size of one byte. So after every transmitted byte by the CC2541 the host pulls its flow control line high, gets the byte out of the RX buffer, echos the byte to the CC2541 and clears the flow control line and is ready to receive another byte. As long as the Host pulls it flow control line high, the CC2541 waits before sending the next byte This works fine as expected. You see it in the attached logic analyzer screenshots.
The weird behaviour happens on the Flow Control Line controlled by the CC2541: This line gets repeatedly pulled high for a few µs. I found out, that this happens all the time when the function HalUARTPoll() is called. By including a hard coded delay in the UART Callback function which is called by the poll function (normally used to press the different HAL UART events) I see that the duration of the high state in the flow control is respectively longer.
You can see screenshot of this behaviour. On a larger time scale one can see that every 30ms the polling is stopped due to a connected BLE state with a connection interval of 30ms (during BLE events the UART poll is not Calle by the OSAL).
The behaviour does not disturb the operation of the system as the peaks on the flow control are too short to cause problems. Nevertheless this behaviour looks messy to me and I doesn't look to me as intended.
My Question: How can I prevent that the HW Flow Control line is pulled high during HalUARTPoll()
Thank you all for your help! :-)
![]()
![]()
Appendix:
Firmware based on simpleBLEPeripheral
Relevant Firmware Code:
Defined Preprocessor symbols:
INT_HEAP_LEN=3072
HALNODEBUG
OSAL_CBTIMER_NUM_TASKS=1
xPOWER_SAVING
HAL_AES_DMA=TRUE
HAL_DMA=TRUE
xPLUS_BROADCASTER
HAL_LCD=FALSE
HAL_LED=FALSE
HAL_KEY=FALSE
HAL_UART=TRUE
HAL_UART_DMA=2
HAL_UART_ISR=0
HAL_UART_DMA_IDLE=5
HAL_UART_DMA_HIGH=48
HAL_UART_DMA_TX_MAX=128
HAL_UART_DMA_RX_MAX=128
UART Init routine:
serialInterface_uartConfig.configured = TRUE;
serialInterface_uartConfig.baudRate = HAL_UART_BR_115200;
serialInterface_uartConfig.flowControl = TRUE;
serialInterface_uartConfig.flowControlThreshold = 48;
serialInterface_uartConfig.rx.maxBufSize = 128;
serialInterface_uartConfig.tx.maxBufSize = 128;
serialInterface_uartConfig.idleTimeout = 5;
serialInterface_uartConfig.intEnable = FALSE;
serialInterface_uartConfig.callBackFunc = (halUARTCBack_t)serialInterface_uartCallback;
(void)HalUARTOpen(HAL_UART_PORT_1, &serialInterface_uartConfig);
UART Callback Routine
void serialInterface_uartCallback( uint8 port, uint8 events )
{
//unused input parameters, function does nothing at the moment
(void)port;
(void) events;
return;
}
UART Write (in Main Task, called periodically, every 1000ms):
HalUARTWrite(HAL_UART_PORT_1, "Test", 4);
UART Read (in Main Task, called periodically (every 500ms)):
len = Hal_UART_RxBufLen(HAL_UART_PORT_1);
HalUARTRead(HAL_UART_PORT_1, &buf, len);