Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
101 views
in Technique[技术] by (71.8m points)

c++ - UART blocks TIRTOS

′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(&params);
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, &params);
question from:https://stackoverflow.com/questions/65935521/uart-blocks-tirtos

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...