This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R: Usage of Util_constructClock

Part Number: CC2652R


Hi,

The callback function of Util_constructClock can only send semaphore or message?  Please check the following code:

1.Snippet pf original example

static void SimplePeripheral_clockHandler(UArg arg)
{
  spClockEventData_t *pData = (spClockEventData_t *)arg;

  if (pData->event == SP_PERIODIC_EVT)
  {
    // Start the next period
    Util_startClock(&clkPeriodic);

    // Post event to wake up the application
    SimplePeripheral_enqueueMsg(SP_PERIODIC_EVT, NULL);
  }
  else if (pData->event == SP_READ_RPA_EVT)
  {
    // Start the next period
    Util_startClock(&clkRpaRead);

    // Post event to read the current RPA
    SimplePeripheral_enqueueMsg(SP_READ_RPA_EVT, NULL);
  }
  else if (pData->event == SP_SEND_PARAM_UPDATE_EVT)
  {
    // Send message to app
    SimplePeripheral_enqueueMsg(SP_SEND_PARAM_UPDATE_EVT, pData);
  }
}

void Clock0_handler(UArg arg)
{
     //uart0 send
}

void Clock1_handler(UArg arg)
{
     //read adc
     //oled display 
}

2.Custom code----add a new task

void Test_createTask()
{
    Task_Params taskParams;

    // Configure task
    Task_Params_init(&taskParams);
    taskParams.stack = testTaskStack;
    taskParams.stackSize = TEST_TASK_STACK_SIZE;
    taskParams.priority = TEST_TASK_PRIORITY;

    Task_construct(&testTask, Test_taskFxn, &taskParams, NULL);
}

static void Test_taskFxn(UArg a0, UArg a1)
{
    uint32_t events=0;

    oled_init();
    uart_init();


    for(;;)
    {

        events = TestEvent_pend(EVENT_START_TEST
                                |EVENT_MY_UARTEMULATRO
                                , 0x0fffffff);


        if(events)
        {
            if (events & EVENT_START_TEST)
            {

               age_board_process();

            }
            else if (events & EVENT_MY_UARTEMULATRO)
            {
                MyEvent_uartEmulatorHandle();//scif 串口发送
            }
        }

        events=0;
    }
}

Clock0_handler runs every second and send data with UART0. The problem is: the chip crashes in a unfixed time, 10 seconds, 30 seconds, a couple of minutes or hours. Most of  the crashes happen in 30 seconds.

Is this because of the Util_constructClock?

BR,

Viki