Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650
Tool/software: TI-RTOS
I have a working modified version of the SimpleBLEperipheral project, that sends data over BLE to a peer device, once notifications are enabled.
I'm trying to add another task, that reads data over UART (from another cc2650, but right now I'm manually typing characters through Putty).
There's no logical dependency between the two tasks, one communicates over BLE and the other one just reads from UART.
Each of the two tasks run perfectly by itself, but when I create the two of them only the BLE task is working.
Specifically, the execution gets to the Semaphore pend (see bellow), but the UART read callback function is never called.
At first, when I created the two tasks, none of them run, and when I increased the BLE task stack size it worked. But, this "trick" did not work for the UART task.
Any ideas on how to debug this? or what could be the reason for this behavior?
Following is the UART code.
Many thanks!
void UART_taskFxn(UArg arg0, UArg arg1)
{
// Initialize application
UART_task_init();
UART_Params uartParams;
measurement_t* meaPtr;
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readMode = UART_MODE_CALLBACK;
uartParams.readCallback = uartReadCallback;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
UART_read(uart, &rxMsg, MEASURMENT_LEN_BYTES);
while (1)
{
Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
while (!Queue_empty(measurementQueueHandle))
{
meaPtr = Queue_dequeue(measurementQueueHandle);
free(meaPtr);
// Need to add code here...
}
}
}
static void uartReadCallback(UART_Handle handle, void *buf, size_t count)
{
measurement_t *measurmentPtr = (measurement_t *) malloc(sizeof(measurement_t));;
strncpy(measurmentPtr->data, buf, count);
Queue_enqueue(measurementQueueHandle, &measurmentPtr->_elem);
Semaphore_post(semHandle);
PIN_setOutputValue(ledPinHandle, Board_LED1, !PIN_getOutputValue(Board_LED1));
UART_read(uart, &rxMsg, MEASURMENT_LEN_BYTES);
}