′I've been trying to develope an APP for TI's CC2650. Im working with the SimpleBLEperipheral example. What I want to do is:
- Set the 'SBP_PERIODIC_EVT_PERIOD' to 1000 ms
- Read the UART
- Write a Peripheral Characteristic
My problem is:
When I set the 'SBP_PERIODIC_EVT_PERIOD' to 1000 ms, the code works for a while, but then stops, after 10-20 mins. If the time is set to more that 1500ms this problem doesn't occure. I think the UART_read function takes to long and gets cancled, which leads to the code hanging. What can I do?
My code for the write is:
static void SimpleBLEPeripheral_performPeriodicTask(void)
{
#ifndef FEATURE_OAD_ONCHIP
//Read data from UART RX to Buffer
if ( UART_read(my_Handle, &my_Buffer, SIMPLEPROFILE_CHAR4_LEN) != 0 )
{
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, SIMPLEPROFILE_CHAR4_LEN, my_Buffer);
}
else
{
System_printf("Couldn't read UART");
}
#endif //!FEATURE_OAD_ONCHIP
}
This is how I initialize the UART:
UART_Params_init(¶ms);
params.baudRate = 4800;
params.writeDataMode = UART_DATA_BINARY;
params.readDataMode = UART_DATA_BINARY;
params.readTimeout = UART_WAIT_FOREVER;
params.writeTimeout = UART_WAIT_FOREVER;
params.readReturnMode = UART_RETURN_FULL;
params.readEcho = UART_ECHO_OFF;
my_Handle = UART_open(Board_UART, ¶ms);
question from:
https://stackoverflow.com/questions/65935521/uart-blocks-tirtos 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…