IC: CC2642
SDK: simplelink_cc13x2_26x2_sdk_3_20_00_68
官方的是这样的:
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
}
我还新建了一个任务:
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每秒运行一次,使用uart0发送数据,出现的问题是:不定时死机,有时候10秒,有时候30多秒,几分钟,几小时,大多数都在30多秒就死机了,
请问这是因为定时器的问题吗?