2020-06-30 06:28 AM
Hi,
I’m using STM32f767zi with FreeRTOS kernel. I have two task:
1- one of them are triggered by task notifications from interrupt every 100ms and receives some data through TCP.
2- the other task is taking some requests from PC.
Now, if task-2 do system reset using “NVIC_SystemReset�? upon request from PC, system reset fails and every things hangs. When I run debugger and halt it stops at “vPortRaiseBASEPRI�?. In disassembly that is a few lines after “vTaskNotifyFromISR�? which is the notification I used for task-1.
When I remove task notification and use just a flag in the interrupt, the system reset works fine. However, I think this way consumes the processor cycles.
I tried to disable interrupts “portDISABLE_INTERRUPT�?, tasks “vTaskSuspendAll�? or enter critical “taskENTER_CRITICAL�? but nothing work.
I did a way around by requesting to “portDISABLE_INTERRUPT�? in an independent request(so that any pended interrupt or “notification�? can finish), then sending system reset in another request. This one works, however, it is not safe from user perspective because the user can (by mistake) do the system reset before disabling interrupts.
Note that when I do hardware reset (push button on board) it works fine?!
So, any idea how to solve this problem? how to reset the board by software without that issue?
2020-07-02 12:35 PM
The problem solved by simply adding some delay after disabling task-1 interrupt:
NVIC_DisableIRQ(IRQn);
vTaskDelay(xTicksToDelay);
NVIC_SystemReset();
I still don't know if this solved the root cause.