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.

sensor controller task停止后再次重启失败,如何解决这个问题?

有2个sensor controller task,一个是 ADC 采样task,一个是io引脚唤醒task。

测试过程如下:

1. 应用程序初始化 sensor controller ,启动ADC 采样task 

2. ADC 采样task 连续采样到电压为0,达到设定次数,产生中断事件通知应用程序

3. 应用程序将 ADC 采样task 停止,然后启动 io引脚唤醒task;

4. 手动按钮,产生上升沿电压, 唤醒事件(io引脚上的上升沿),io引脚唤醒task 产生中断事件,通知应用程序。

5. 应用程序停止  io引脚唤醒task,随即调用接口 scifStartTasksNbl,启动 ADC 采样task 。这个操作,总是失败。

6. 遇到前述错误后的尝试1:使用 scifSwTriggerExecutionCodeNbl 启动任务,任务可以执行一次,后续没有触发,似乎 rtc 停止了。

7. 遇到前述错误后的尝试2:在调用接口scifSwTriggerExecutionCodeNbl 启动任务前,如果执行 scifStartRtcTicks,任务会多执行一次,后续就没有触发了。 

以下代码为sc task 启动和停止:

if(evtType ==2){

//wake up event
// Stop the "wakeTask" Sensor Controller task
if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {

Log_info0("wait sc timeout");

} else if (scifStopTasksNbl(1 << SCIF_WAKE_TASK_TASK_ID) != SCIF_SUCCESS) {

Log_info0("stop wakeup task fail");

}else{

Log_info0("stop wakeup task success");

}

// Run the "adcTask" Sensor Controller task

// scifStartRtcTicks(500,0x00010000 / 300);
if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {

Log_info0("wait sc timeout 1");

//} else if (scifSwTriggerExecutionCodeNbl(1 << SCIF_ADC_TASK_TASK_ID ) != SCIF_SUCCESS) {

} else if (scifStartTasksNbl(1 << SCIF_ADC_TASK_TASK_ID ) != SCIF_SUCCESS) {

Log_info0("start adc task fail");                     // ------------------------------------------------------------------此处打印失败----------------------------------------

}else{

Log_info0("start adc task success");

}
idleCnt=0;

}