Part Number: CC1352P
Tool/software: TI-RTOS
We're trying to use the read/write callback functions when setting up the UART driver. Our initialization is as follows:
UART_init();
UART_Params_init(¶ms);
params.readMode = UART_MODE_CALLBACK;
params.writeMode = UART_MODE_CALLBACK;
params.readCallback = UartMgr_readCallback;
params.writeCallback = UartMgr_writeCallback;
params.readReturnMode = UART_RETURN_FULL;
params.readDataMode = UART_DATA_BINARY;
params.writeDataMode = UART_DATA_BINARY;
params.readEcho = UART_ECHO_OFF;
params.baudRate = H8_UART_DEFAULT_BAUDRATE;
params.dataLength = UART_LEN_8;
params.stopBits = UART_STOP_ONE;
params.parityType = UART_PAR_NONE;
UartMgr_Handle = UART_open(Board_UART0, ¶ms);
// Return partial read, won't wait for buffer full
UART_control(UartMgr_Handle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE,
NULL);
UartMgr_EventHandle = Event_handle(&myTss->eventStruct);
while(TaskRunning != FALSE)
{
// count = UART_read(UartMgr_Handle, buffer, sizeof(buffer));
// if(count > 0)
// {
// UartMgr_ProcessIncomingData(buffer, count);
// }
events = Event_pend(UartMgr_EventHandle, Event_Id_NONE, EVT_SYS_MSG + EVT_SHUTDOWN + EVT_TRANSMIT_DONE + EVT_RECEIVE_CHARS, BIOS_WAIT_FOREVER);
if(events != 0) { ...
if(events & EVT_RECEIVE_CHARS)
{
UartMgr_ProcessIncomingData();
events &= ~EVT_RECEIVE_CHARS;
}
...}
The problem we're seeing is that our readCallback is not getting called when serial data is sent.
void UartMgr_readCallback(UART_Handle handle, void *buf, size_t count)
{
uartMgrReceiveLen = count;
Event_post(UartMgr_EventHandle, EVT_RECEIVE_CHARS);
}
We do get data if we simply use the defaults for the open parameters and UART_read(UART_read(UartMgr_Handle, buffer, sizeof(buffer)); so we know the hardware is working.
Any thoughts on what we're doing wrong?
Thanks,
- Bill