platform-espressif32 icon indicating copy to clipboard operation
platform-espressif32 copied to clipboard

Watchdog issue on esp32-c3-devkitm-1

Open brunofgc opened this issue 3 years ago • 16 comments

Hi there.

I'm facing an issue on my program. It hapens ramdomly. There is no pattern, or I didn't realise the pattern. It's working ok and suddenly the issue appears. You can see the issue description bellow:

E (6578683) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (6578683) task_wdt: - IDLE (CPU 0) E (6578683) task_wdt: Tasks currently running: E (6578683) task_wdt: CPU 0: wifi

Have you ever seen this before? Thank you in advance.

brunofgc avatar Jun 30 '22 15:06 brunofgc

Hi @brunofgc ! What framework are you using? What task is running on CPU 1? Are you doing anything unusual with the Wi-Fi peripheral? Usually, such issues caused by user's main code which simply runs too long so that the idle talk doesn't get a chance to feed the watchdog.

valeros avatar Jul 04 '22 08:07 valeros

Hi Valeros, thank you for your help. I'm sorry for the delay.

I'm using Arduino Framework on PlatformIO plus Visual Studio IDE. And ESP32-C3-RISC-V Processor ( https://www.espressif.com/en/products/socs/esp32-c3 )

This MCU Variant has only One CPU Core. Only the "CPU 0".

I tried my best to put vTaskDelay(1) (at least) on every while or for loops.

It works for a long period, but eventualy stops.

I'm not using anything very different. This firmware deals with Bluetooth Advertisements, Bluetooth Connections, and also MQTT Thru WiFi, but there are "Boolean flags" to prevent they run at same time.

Even if they're able to do it. I tested this before and the Processor was able to handle all those tasks together.

I have the main loop() and also a second thread.

brunofgc avatar Jul 22 '22 12:07 brunofgc

Hi @brunofgc ! What framework are you using? What task is running on CPU 1? Are you doing anything unusual with the Wi-Fi peripheral? Usually, such issues caused by user's main code which simply runs too long so that the idle talk doesn't get a change to feed the watchdog.

Hi, do you know a solution for this?

lucasromeiro avatar Jul 22 '22 12:07 lucasromeiro

I could manage to get the start of the issue:

DIAG0 1000e1a0 DIAG1 120b0000 BB DIAG0: 000a5384 BB DIAG1: ba002e02 BB DIAG2: 00000000 BB DIAG3: 8e89bed6 BB DIAG4: 00000000 BB DIAG5: 00000000 assert rwble.c 261, param 00020000 00000000 E (1145352) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (1145352) task_wdt: - IDLE (CPU 0) E (1145352) task_wdt: Tasks currently running: E (1145352) task_wdt: CPU 0: wifi E (1150352) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (1150352) task_wdt: - IDLE (CPU 0) E (1150352) task_wdt: Tasks currently running: E (1150352) task_wdt: CPU 0: wifi E (1155352) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (1155352) task_wdt: - IDLE (CPU 0) E (1155352) task_wdt: Tasks currently running: E (1155352) task_wdt: CPU 0: wifi

As you can see, it refers to a file "rwble.c"

Maybe someone experienced on the diagnostic codes could better solve this problem:

DIAG0 1000e1a0 DIAG1 120b0000 BB DIAG0: 000a5384 BB DIAG1: ba002e02 BB DIAG2: 00000000 BB DIAG3: 8e89bed6 BB DIAG4: 00000000 BB DIAG5: 00000000 assert rwble.c 261, param 00020000 00000000

brunofgc avatar Jul 24 '22 14:07 brunofgc

@valeros @metcalf @rgl can help in this case?

lucasromeiro avatar Jul 24 '22 15:07 lucasromeiro

First of all, I'd recommend trying the latest platform from the development branch as is has support for the latest Arduino v2.0.4.

[env:esp32-c3-devkitm-1]
platform = https://github.com/platformio/platform-espressif32.git
framework = arduino
board = esp32-c3-devkitm-1

If doesn't work with the latest dev-platform then try your project in the Arduino IDE. After that we'll be able to roughly locate where the issue might be.

valeros avatar Jul 25 '22 18:07 valeros

Thank you @valeros, I was busy to reply or even try it. I'll do my best to try those tips and I'll be back to provide you the results.

brunofgc avatar Jul 26 '22 01:07 brunofgc

Hi @valeros unfortunately I tried updating the platform, it becomes a bit more stable, but it keeps freezing out. I'll try the Arduino 2.0 platform and give you a feedback.

brunofgc avatar Jul 29 '22 19:07 brunofgc

I also got a better working using a vTaskDelay(50) on the ending of the loop() (main task)

brunofgc avatar Jul 29 '22 19:07 brunofgc

Unfortunately after doing the update, I got experiencing anther bug. On begining of the code, it freezes out and provide this status.

And start a loop of restarts

Stack smashing protect failure!

abort() was called at PC 0x42039f9d on core 0 Core 0 register dump: MEPC : 0x40382552 RA : 0x40388af2 SP : 0x3fca8fe0 GP : 0x3fc90800 TP : 0x3fc82c40 T0 : 0x37363534 T1 : 0x7271706f T2 : 0x33323130 S0/FP : 0x3fca900c S1 : 0x3fca900c A0 : 0x3fca9018 A1 : 0x3fca8ffa A2 : 0x00000000 A3 : 0x3fca9045 A4 : 0x00000001 A5 : 0x3fca1000 A6 : 0x7a797877 A7 : 0x76757473 S2 : 0x62e40a81 S3 : 0x3c0f2000 S4 : 0x3fca1000 S5 : 0x3fca30b6 S6 : 0x3fca9070 S7 : 0x3fca3097 S8 : 0x3fc9c000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000 T3 : 0x6e6d6c6b T4 : 0x6a696867 T5 : 0x66656463 T6 : 0x62613938 MSTATUS : 0x00001801 MTVEC : 0x40380001 MCAUSE : 0x00000007 MTVAL : 0x00000000 MHARTID : 0x00000000

Stack memory: 3fca8fe0: 0x00000000 0x00000000 0x3fca8ff8 0x4038e978 0x3fca9070 0x3fca30b6 0x3fca0030 0x3fc92cd8 3fca9000: 0x3fca900c 0x3fc92cf4 0x3fca8ff8 0x33303234 0x64396639 0x00000000 0x726f6261 0x20292874 3fca9020: 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x39333032 0x20643966 0x63206e6f 3fca9040: 0x2065726f 0x00000030 0x00000000 0x76354a98 0x00120cba 0x3fc9c000 0x3fca9200 0x42039fa0 3fca9060: 0x62e40a81 0x3fca0e7a 0x3fca9200 0x42008ac0 0x7974227b 0x3a226570 0x74657322 0x6374725f 3fca9080: 0x64222c22 0x22617461 0x3536313a 0x32313139 0x7d353630 0x00000000 0x3fcc4e94 0x40389040 3fca90a0: 0x00000000 0x00000000 0x3fcc4e94 0x4038955e 0x00000000 0x00000005 0x00000000 0x00000000 3fca90c0: 0x00000043 0x00000045 0x3fcb654c 0x40389040 0x5f746573 0x00637472 0x3fca9207 0x0000059c 3fca90e0: 0x3fc9c948 0x00000000 0x00000000 0x42060b76 0x3fca913c 0x00000000 0x3fc9c934 0x4204d788 3fca9100: 0x00000043 0x39353631 0x30323131 0xbe003536 0x4801ccc7 0x5ef4286c 0x55abc18b 0xd96839f5 3fca9120: 0x397d133f 0x2f207bc9 0x63d85bd9 0xdc06d6bc 0x6540b526 0xbc274788 0xeb8f8854 0xd11ca660 3fca9140: 0x53d6e0f0 0x7480ddeb 0x8f58a0fa 0xb09ecf78 0x529472ee 0x32677cbe 0x1f1cb58b 0x5e6b1b46 3fca9160: 0x56dcd84f 0xe335539f 0x14bf7044 0xfd6b5e37 0x9210ad69 0xd59fab31 0x6c5695a3 0x5a180157 3fca9180: 0xecb36f79 0x39231c86 0x39fe16dc 0x08d57102 0xb29038a1 0x713e6013 0xf5251cbf 0x7ec41e16 3fca91a0: 0xeff49d10 0xd613fc2b 0x861530b3 0xb1e7dd1b 0x4b69ac17 0x3d9f204a 0xfdc72a4c 0x9bb5ba75 3fca91c0: 0xd7cc741c 0xeb913649 0xad567808 0x00120cba 0x3fca0e82 0x3fc94000 0x00000000 0x00000000 3fca91e0: 0x00000000 0x3c0f07f8 0x0000059b 0x00000001 0x0000001e 0x00000024 0x3fc93ad4 0x4200b2e2 3fca9200: 0x3fca1000 0x010f07f8 0x00000000 0x00000000 0x00000000 0x3fca3097 0x3fca30b6 0x00000024 3fca9220: 0x00000000 0x3c0f07f8 0x3fca1000 0x3fca1000 0x0000185b 0x3fc94000 0x3fca0e82 0x42001552 3fca9240: 0x3fca0e78 0x3fca1000 0x00000000 0x42005ef4 0x00000001 0x00000001 0x3fca12bc 0x600c2000 3fca9260: 0x3fca9394 0x00000bb8 0x3fca92ec 0x00000000 0x00000000 0x3fcb67a4 0x3fca1000 0x4038b080 3fca9280: 0x00000031 0x3c0f6218 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x40389040 3fca92a0: 0x00000000 0x00000000 0x3fcb654c 0x4038955e 0x3fca93f8 0x00000000 0x00000000 0x00000000 3fca92c0: 0x000f4240 0x3fca3097 0x00000025 0x3fca938c 0x00000000 0x3fca942f 0x00000008 0x3fca938c 3fca92e0: 0x0000000c 0x00000000 0x3fcc4c14 0x42060b76 0x00000000 0x00000000 0x3fcc4c14 0x42062488 3fca9300: 0x00000000 0x3fca938c 0x3fcc4c14 0x4038b080 0x00000000 0x00000000 0x3fcc4e94 0x00000000 3fca9320: 0x0000000c 0xfffffff5 0x3fcc4e94 0x40389040 0x00000000 0x00000000 0x3fcc4e94 0x4038955e 3fca9340: 0x000f4240 0x3fca3097 0x00000000 0x00000000 0x00000000 0x00000000 0x0000000b 0x4038acb2 3fca9360: 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc9c948 0x00000000 0x00000000 0x42060b76 3fca9380: 0x00000000 0x00000000 0x3fca3097 0x4204d788 0x00000000 0x00000008 0x3fc93a8c 0x00000000 3fca93a0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xffffffff 0x3fc9c934 0x4204ebe4 3fca93c0: 0x00020000 0x00000009 0x3fca9404 0x3fca942f 0x3fc937ba 0x000003e8 0x3fc93a8c 0x4038acb2

ELF file SHA256: 0000000000000000

Rebooting...

brunofgc avatar Jul 29 '22 19:07 brunofgc

Hi @valeros It seems that I could fix the "WiFi related issue". I'm not sure what was done to fix it. But I updated the platform as you mentioned, I'm using flags to prevent simultaneous BLE Scans and distributed yield() in some points of the code.

Now I'm getting another problem:

DIAG0 1000e1a0 DIAG1 10000000 BB DIAG0: 000a4604 BB DIAG1: c1002e02 BB DIAG2: 00000000 BB DIAG3: 8e89bed6 BB DIAG4: 00000000 BB DIAG5: 00000000 assert rwble.c 261, param 00020000 00000000

Maybe you know how to reach the rwble.c writer. It seems to be something in the lib itself. It happens random in time. Keeps hours working, and suddenly freeezes after printing that diagnostic text.

brunofgc avatar Aug 01 '22 10:08 brunofgc

Hi @brunofgc ! Did you try your project in the Arduino IDE? Does it work there? Anyway, the Arduino framework is built on top of https://github.com/espressif/esp-idf, so this file should be there.

valeros avatar Aug 01 '22 11:08 valeros

@valeros I didn't try it on Arduino IDE yet. It works fine, but eventualy stops with that issue. It seems to be another issue.

I'll try it on Arduino IDE.

brunofgc avatar Aug 01 '22 11:08 brunofgc

Anyone have a working pio env? I cannot get my C3 devkit to to boot at all, same loops.

tablatronix avatar Aug 23 '22 16:08 tablatronix

Issue is fixed. Use latest release. If it still does not work delete folder .platformio and Platformio will fetch the latest. This is needed since old reminents are left.

Jason2866 avatar Aug 26 '22 12:08 Jason2866

Bad flash mode in bootloader, wipe pio cache and platform as mentioned above

tablatronix avatar Aug 31 '22 17:08 tablatronix

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 01 '22 03:10 stale[bot]