Issues when adding a real time task

Fluffy_Port
Posts: 8
Joined: Wed Jan 18, 2023 11:20 pm

Issues when adding a real time task

Postby Fluffy_Port » Fri Feb 10, 2023 11:43 am

I had a simple code to my project for the ESP32 that basically SCAN Wifis nad then allows you to connect to any of the networks selecting the SSID and password. Works perfectly until i decied to add a real time task that cheks every 500 ms if the connection is still active and print something (simple as that).

Code: Select all

xTaskCreatePinnedToCore(
check_net,
“check_net”,
2000,
NULL,
2,
NULL,
0);
void check_net(void * parameter){
if(WiFi.status()!=WL_CONNECTED) Serial.println(“Conexión perdida.Reconectando…”);
else Serial.println(“Todo en orden jefe WOF WOF.”);
vTaskDelay(5000/portTICK_PERIOD_MS);
}
Now the issue I find is that as soon as the task activates I get this in the terminal:

Code: Select all

Guru Meditation Error: Core 0 panic’ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d2814: 2fe5f604 000090bb 46d0a7a2
Core 0 register dump:
PC : 0x400d2819 PS : 0x00060130 A0 : 0x00000000 A1 : 0x3ffcfaa0
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800d2819 A9 : 0x3ffcfa80
A10 : 0x00001388 A11 : 0x3ffbf528 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x3ffcea8c A15 : 0x80000001 SAR : 0x00000000 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

Backtrace: 0x400d2816:0x3ffcfaa0

ELF file SHA256: 300426ae34e0ad6b

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13104
load:0x40080400,len:3036
entry 0x400805e4
I have no idea how to solve this. I tried to switch between cores or change the stack size but the problem still exist. I’d apreciate any help. Thanks.

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Issues when adding a real time task

Postby ESP_Sprite » Sat Feb 11, 2023 3:15 am

Try increasing the allocated amount of stack, for one.

Fluffy_Port
Posts: 8
Joined: Wed Jan 18, 2023 11:20 pm

Re: Issues when adding a real time task

Postby Fluffy_Port » Sat Feb 11, 2023 5:57 pm

I changed it from 2000 to 10000 and I even tried with less. The problem wasn't solved.

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Issues when adding a real time task

Postby ESP_Sprite » Sun Feb 12, 2023 1:49 am

Ah, never mind. I see that your task does not contain an infinite loop. Task functions cannot just return, they either need to run forever (while(1)) or use vTaskDelete(NULL) to delete themselves.

Fluffy_Port
Posts: 8
Joined: Wed Jan 18, 2023 11:20 pm

Re: Issues when adding a real time task

Postby Fluffy_Port » Mon Apr 10, 2023 9:40 pm

ESP_Sprite wrote:
Sun Feb 12, 2023 1:49 am
Ah, never mind. I see that your task does not contain an infinite loop. Task functions cannot just return, they either need to run forever (while(1)) or use vTaskDelete(NULL) to delete themselves.
Thanks very much for your help. I thought I replied but it seems it totally went over my head.

Who is online

Users browsing this forum: No registered users and 48 guests