-
Hi, I am facing difficulty in understanding why my code gives a watchdog fail error and then led 1 blinks with five pulses. I am trying peer to peer communication and using usec_time.h to measure round trip time.
Below is mode code in app(which is what I am playing around mostly). and console output. I will appreciate if you have any tips or tutorial to follow for better understanding on debugging the code crazyflie ecosystem and pin pointing the issue. Thanks
Console output SYS: Crazyflie 2.1 is up and running! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Are you sure there are no cases where the code may loop without sleeping? This could cause problems |
Beta Was this translation helpful? Give feedback.
-
Hi Rik,
Is it necessary to sleep in app? Can we not have indefinite loop in main app?
I think you have pointed out correctly. I noticed that I need to have atleast 1 millisecond delay in a while loop to remove this error.
I wonder how do we avoid that? I think during sleep watchdog is fed. is this right? Is there any instruction to feed watchdog in main app without adding delay of 1 millisecond?
For delay I am using vtaskdelay.
Junaid
On 20 Dec 2024, at 11:24 am, Rik ***@***.***> wrote:
Are you sure there are no cases where the code may indefinitely loop without sleeping? This could cause problems
—
Reply to this email directly, view it on GitHub<#1703 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGC62YIOZ6MAEKIN5K3E2AD2GP45XAVCNFSM6AAAAABT5QYRUGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNRSG43TOMY>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Hi @jmemon16!
The watchdog is being fed from the idle task and it has the lowest priority of all tasks. So if your main task is loading the CPU 100% the idle task will never be able to run and feed the watchdog.
I would in general not advice to load the CPU 100%, since this might cause unexpected behaviors, unless you are very knowledgeable on all the priorities of all running tasks.
You can feed the watchdog from your main task by calling watchdogReset().
See
void vApplicationIdleHook( void )
in src/modules/system.c to see how it is done in the idle task.I hope this answered your question!