Other Parts Discussed in Thread: SYSCONFIG
In my application i use the UART for interactive control.In some places i have a loop that waits for some other external events like a packet receive. To abort this loop i check for a key-press/UART-RX of ESCAPE. For the waiting on the packet-receive i use RF_runCmd() with CMD_PROP_RX_SNIFF:
bool UART_getRxReady(UART_Handle hUART) { UARTCC26XX_Object* obj = (UARTCC26XX_Object*) (hUART->object); RingBuf_Handle rb = &(obj->ringBuffer); return (RingBuf_getCount(rb) >0); } bool checkAbort(UART_Handle hUART) { if (UART_getRxReady(hUART)) { char ch = 0; int n = UART_read(hUART, &ch, 1); if (ch ==ESCAPE) return true; } return false; } void waitForPacket() { bool done = false; while (!done) { RF_runCmd(...) if (packetReceived) { done = true; } else if (checkAbort()) done = true; } }
With this loop, i never receive a character. To check i have created another test loop:
void testLoop() { bool done = false; while (!done) { Task_sleep(someValue); if (checkAbort()) done = true; } }
This loop also does not receive a character. If i omit the Task_sleep(), it works and can aborted with a ESCAPE.
I suspect it has something to do with the power-policies that shut down the UART-receive while processor goes to sleep.
An suggestion how i can make it working to receive thru UART while processor is in Task_sleep() or Semaphore_pend()?