Problem with watchdog !

erimads@gmail.com
Posts: 9
Joined: Fri Jan 26, 2024 6:53 pm

Problem with watchdog !

Postby erimads@gmail.com » Fri Jan 26, 2024 7:17 pm

Every ca. 6 secund I get this out of ESP32.
E (85334) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (85334) task_wdt: - IDLE (CPU 0)
E (85334) task_wdt: Tasks currently running:
E (85334) task_wdt: CPU 0: Task1
E (85334) task_wdt: CPU 1: IDLE
E (85334) task_wdt: Print CPU 0 (current core) backtrace


Backtrace: 0x400D826B:0x3FFB0D20 0x400D83F2:0x3FFB0D40 0x400829B9:0x3FFB0D60 0x400D6213:0x3FFB8380 0x400D567F:0x3FFB83C0 0x40087D89:0x3FFB83F0
I need to run a task that is scanning a huge led matrix 64x32 rgb leds. I have tryed many solution found on the internet.
Eiher dos it not work at all or it slows the scanning down resulting at the display is twinkle. her is the code, the outer loop have to run ca.1600 times a secund and the inner loop 102400 times a secund to avoid twinkle.

xTaskCreatePinnedToCore(Task1code,"Task1",10000,NULL,1,&Task1,0);

void Task1code(void * pvParameters)
{
while(1)
{
if(LedRow>7)
{
L=1;
H=3;
}
else
{
L=0;
H=2;
}
Msk=1;
Msk=Msk << (LedRow & 7);
for(int k=0;k<64;k++)
{
Rtmp1=Red[k][L];
Gtmp1=Green[k][L];
Btmp1=Blue[k][L];
Rtmp2=Red[k][H];
Gtmp2=Green[k][H];
Btmp2=Blue[k][H];
gpio_set_level(R1,Rtmp1 & Msk);
gpio_set_level(G1,Gtmp1 & Msk);
gpio_set_level(B1,Btmp1 & Msk);
gpio_set_level(R2,Rtmp2 & Msk);
gpio_set_level(G2,Gtmp2 & Msk);
gpio_set_level(B2,Btmp2 & Msk);
gpio_set_level(CLK,1);
gpio_set_level(CLK,0);
}
gpio_set_level(OE,1);
gpio_set_level(AA,LedRow & 1);
gpio_set_level(AB,LedRow & 2);
gpio_set_level(AC,LedRow & 4);
gpio_set_level(AD,LedRow & 8);
gpio_set_level(OE,0);
LedRow++;
if(LedRow==16) LedRow=0;
}
}
Regards
Erik Madsen

username
Posts: 536
Joined: Thu May 03, 2018 1:18 pm

Re: Problem with watchdog !

Postby username » Sat Jan 27, 2024 7:23 am

You have to remember your running in a RTOS. So if your going to have a while(1) loop that takes to long to do something it will not be able to reset the watchdog in time. Hence you should always use vTaskDelay(x / portTICK_PERIOD_MS);

Secondly, you should look into:
GPIO.out_w1ts //set a pin
GPIO.out_w1tc //clear a pin
and
GPIO.out1_w1ts.val
GPIO.out1_w1tc.val

You will get MUCH faster IO control twiddling IO pins using this method that gpio_set_level()

erimads@gmail.com
Posts: 9
Joined: Fri Jan 26, 2024 6:53 pm

Re: Problem with watchdog !

Postby erimads@gmail.com » Sat Jan 27, 2024 7:18 pm

dont work with vtaskdelay it has to be more than 10 ms to work at this my scan will go most to slow.
I just needded a command/function to feed the dog or maybe to kill the dog.
I try to run it with timer interrupt task 1000 times a secund but it gives the same problev or it is worse

username
Posts: 536
Joined: Thu May 03, 2018 1:18 pm

Re: Problem with watchdog !

Postby username » Sun Jan 28, 2024 8:19 am

If you go into menuconfig you can disable WDT.

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Problem with watchdog !

Postby MicroController » Mon Jan 29, 2024 11:50 am

erimads@gmail.com wrote:
Sat Jan 27, 2024 7:18 pm
the outer loop have to run ca.1600 times a second
625µs... Should be possible via a GP timer.
Then, running in the timer's callback, you can try and optimize the 'inner loop' for speed to reduce overall CPU load.

Who is online

Users browsing this forum: Baidu [Spider], markkuk and 302 guests