Last Task of freeRTOS reset the stm32l4

hello everyone!

I am working on stm32 with freeRTOS, I created four tasks and they are properly manage but the last task which is “SleepMode” after executing it, the device reset itself why? i know the issue is not in task but once all task execute themselves then the device reset itself which is not good for my appliction, please suggest the solution?

thank you.

Can you post the relevant code ?

Is that “SleepMode” task putting the processor into a deep sleep? Some of the deepest sleep modes do a reset to wake up, so aren’t really usable in a real time application unless it IS prepared to need a reset.

yes! i am using stop2 mode. but it does not matter because i comnent out those code but still reset.

Would you be able to provide sample code that reproduces this issue? That would be helpful in figuring out the cause.

Have you applied the suggestions provided in this post - FreeRTOS with stop2 mode using rtc for wakeup. If yes, please share the complete code as others have asked.

1 Like





		// Notify configuration and adxl tasks to unblock them for the next iteration

this is the code where it goes to reset. yes, you are right i figure out that it is due to when it goes out from sleep mode. so how can i resolve it?

I think the SleepMode task exits properly without triggering critical errors or stack overflows. Stack sizes and memory allocations across all tasks to prevent resource exhaustion.

1 Like

you are using a watch dog along with sleep mode? Is that supported by the hardware? Have you tried running thd code without an active watch dog?

1 Like

yes it support. i have tried without watch dog.

I posted this query, and I received wonderful responses. I appreciate your help.
I figured out the reason: if all of the tasks enter to a block state, and there is not other task in process that’s why the device reset itself.

But the Idle task should not have blocked itself unless you did something wrong in the IdleHook.