Other Parts Discussed in Thread: CC2640
I’m seeing a scheduling problem in the bios support library and UART driver. I found that the driver pends until the receive buffer is full even if UART_DATA_TEXT and UART_RETURN_NEWLINE are selected. I implemented a work-around printf function that receives one character at a time.. I still have a problem however. While pending, the calling task appears to spin, not allowing other same priority or lower tasks to run. This is a problem for me since I need to implement two receiver channels.
Below is a list of problems I have found with this driver, Has anyone else observed similar problems and have a solution?
- UART_RETURN_NEWLINE returns after each character instead of each newline
- UART_ECHO_ON doesn’t work
- UART_DATA_TEXT doesn’t fix newlines
- Most importantly, UART_MODE_BLOCKING doesn’t reschedule the task. It spins, waiting for data. This hogs the CPU and prevents this priority and lower priority tasks from running.
/* UART Init */
uartParams.readDataMode = UART_DATA_TEXT;
uartParams.writeDataMode = UART_DATA_TEXT;
uartParams.readMode = UART_MODE_BLOCKING;
uartParams.writeMode = UART_MODE_BLOCKING;
uartParams.readEcho = UART_ECHO_ON;
uartParams.readReturnMode = UART_RETURN_NEWLINE;
uartParams.stopBits = UART_STOP_ONE;
uartParams.parityType = UART_PAR_NONE;
uartParams.baudRate = 115200;
// Add call backs UART parameters.
uartParams.readCallback = NULL;
uartParams.writeCallback = NULL;
// Open / power on the UART.
uartHandle = UART_open(DEBUG_CONSOLE, &uartParams);
//Enable Partial Reads on all subsequent UART_read()
(void)UART_control(uartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL);