Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasionally hit TG1WDT_SYS_RESET when OTA (IDFGH-5615) #7335

Open
AxelLin opened this issue Jul 27, 2021 · 8 comments
Open

Occasionally hit TG1WDT_SYS_RESET when OTA (IDFGH-5615) #7335

AxelLin opened this issue Jul 27, 2021 · 8 comments
Labels
Status: Selected for Development Issue is selected for development

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Jul 27, 2021

Environment

Module or chip used: ESP32-WROOM-32E
IDF version: v4.3-242-g1f7172dbf968
Build System: idf.py
Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2021r1) 8.4.0
Operating System: Linux
Power Supply: USB

CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1
CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192

Problem Description

Hit TG1WDT_SYS_RESET when OTA.
It's not easy to reproduce, but this happens occasionally.

ets Jun 8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_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:4
load:0x3fff0034,len:6012
load:0x40078000,len:13964
ho 0 tail 12 room 4
load:0x40080400,len:3632
0x40080400: _init at ??:?

entry 0x4008064c
W (183) boot.esp32: PRO CPU has been reset by WDT.
W (184) boot.esp32: WDT reset info: PRO CPU PC=0x4008d0fa
0x4008d0fa: spi_flash_hal_erase_block at /home/axel/esp/esp-idf/components/hal/spi_flash_hal_iram.c:65

W (185) boot.esp32: WDT reset info: APP CPU PC=0x4008176e
0x4008176e: start_cpu_other_cores_default at /home/axel/esp/esp-idf/components/esp_system/startup.c:231

I (654) cpu_start: Pro cpu up.
I (654) cpu_start: Starting app cpu, entry point is 0x40081394
0x40081394: call_start_cpu0 at /home/axel/esp/esp-idf/components/esp_system/port/cpu_start.c:405

I (0) cpu_start: App cpu up.
I (747) cpu_start: Pro cpu start user code
I (747) cpu_start: cpu freq: 240000000
...

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jul 27, 2021
@github-actions github-actions bot changed the title Occasionally hit TG1WDT_SYS_RESET when OTA Occasionally hit TG1WDT_SYS_RESET when OTA (IDFGH-5615) Jul 27, 2021
@AxelLin
Copy link
Contributor Author

AxelLin commented Aug 2, 2021

I hit panic while OTA again:
(This time I have mis-configured mqtt so it keeps retry connecting broker when I'm doing OTA)

E (33651) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (33651) task_wdt: - IDLE (CPU 1)
E (33651) task_wdt: Tasks currently running:
E (33651) task_wdt: CPU 0: ipc0
E (33651) task_wdt: CPU 1: mqtt_task
E (33651) task_wdt: Aborting.

abort() was called at PC 0x4012bea0 on core 0
0x4012bea0: task_wdt_isr at /home/axel/esp/esp-idf/components/esp_common/src/task_wdt.c:182 (discriminator 1)

Backtrace:0x40088ea6:0x3ffb0750 0x400895ed:0x3ffb0770 0x40090046:0x3ffb0790 0x4012bea0:0x3ffb0800 0x40082fc1:0x3ffb0820 0x40084a80:0x3ffaf7e0 0x40083842:0x3ffaf800 0x40083794:0x3ffaf820
0x40088ea6: panic_abort at /home/axel/esp/esp-idf/components/esp_system/panic.c:367

0x400895ed: esp_system_abort at /home/axel/esp/esp-idf/components/esp_system/system_api.c:112

0x40090046: abort at /home/axel/esp/esp-idf/components/newlib/abort.c:46

0x4012bea0: task_wdt_isr at /home/axel/esp/esp-idf/components/esp_common/src/task_wdt.c:182 (discriminator 1)

0x40082fc1: _xt_lowint1 at /home/axel/esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1105

0x40084a80: xt_int_enable_mask at /home/axel/esp/esp-idf/components/xtensa/include/xtensa/xtensa_api.h:170
(inlined by) intr_cntrl_ll_enable_int_mask at /home/axel/esp/esp-idf/components/hal/esp32/include/hal/interrupt_controller_ll.h:100
(inlined by) interrupt_controller_hal_enable_int_mask at /home/axel/esp/esp-idf/components/hal/include/hal/interrupt_controller_hal.h:192
(inlined by) esp_intr_noniram_enable at /home/axel/esp/esp-idf/components/esp_system/intr_alloc.c:815

0x40083842: spi_flash_op_block_func at /home/axel/esp/esp-idf/components/spi_flash/cache_utils.c:121

0x40083794: ipc_task at /home/axel/esp/esp-idf/components/esp_ipc/ipc.c:62

Also note, increase CONFIG_ESP_INT_WDT_TIMEOUT_MS to 10000 does not help, it still hit watchdog timeout.

@AxelLin
Copy link
Contributor Author

AxelLin commented Aug 2, 2021

Hit the issue again when test with v4.4-dev-2359-g58022f859940.
This issue seems only happen when CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED=y

E (34329) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (34329) task_wdt: - IDLE (CPU 1)
E (34329) task_wdt: Tasks currently running:
E (34329) task_wdt: CPU 0: simple_app_worker
E (34329) task_wdt: CPU 1: mqtt_task
E (34329) task_wdt: Aborting.

abort() was called at PC 0x400ffed4 on core 0
0x400ffed4: task_wdt_isr at /home/axel/esp/esp-idf/components/esp_system/task_wdt.c:184 (discriminator 3)

Backtrace:0x400d521e:0x3ffb0af00x400890b5:0x3ffb0b10 0x4008fb5a:0x3ffb0b30 0x400ffed4:0x3ffb0ba0 0x40082b0d:0x3ffb0bc0 0x4000bfed:0x3ffca030 0x4008c8fa:0x3ffca040 0x4008201f:0x3ffca060 0x40083eab:0x3ffca080 0x40084e21:0x3ffca0a0 0x40084e5b:0x3ffca0c0 0x40087785:0x3ffca0e0 0x4008447a:0x3ffca100 0x4008495e:0x3ffca120 0x400fca7b:0x3ffca170 0x400fb8ea:0x3ffca190 0x400e6d56:0x3ffca1b0 0x400e7015:0x3ffca1d0 0x400e0de7:0x3ffca210 0x400da642:0x3ffca2b0 0x4019f6ce:0x3ffca2d0 0x4019f74c:0x3ffca320
0x400d521e: panic_abort at /home/axel/esp/esp-idf/components/esp_system/panic.c:402

0x400890b5: esp_system_abort at /home/axel/esp/esp-idf/components/esp_system/esp_system.c:129

0x4008fb5a: abort at /home/axel/esp/esp-idf/components/newlib/abort.c:46

0x400ffed4: task_wdt_isr at /home/axel/esp/esp-idf/components/esp_system/task_wdt.c:184 (discriminator 3)

0x40082b0d: _xt_lowint1 at /home/axel/esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1105

0x4008c8fa: vPortExitCritical at /home/axel/esp/esp-idf/components/freertos/port/xtensa/port.c:476

0x4008201f: vPortExitCriticalSafe at /home/axel/esp/esp-idf/components/freertos/port/xtensa/include/freertos/portmacro.h:231
(inlined by) esp_intr_noniram_enable at /home/axel/esp/esp-idf/components/esp_hw_support/intr_alloc.c:816

0x40083eab: spi_flash_enable_interrupts_caches_and_other_cpu at /home/axel/esp/esp-idf/components/spi_flash/cache_utils.c:206

0x40084e21: cache_enable at /home/axel/esp/esp-idf/components/spi_flash/spi_flash_os_func_app.c:71

0x40084e5b: spi1_end at /home/axel/esp/esp-idf/components/spi_flash/spi_flash_os_func_app.c:119

0x40087785: spiflash_end_default at /home/axel/esp/esp-idf/components/spi_flash/esp_flash_api.c:129

0x4008447a: flash_end_flush_cache at /home/axel/esp/esp-idf/components/spi_flash/esp_flash_api.c:167

0x4008495e: esp_flash_erase_region at /home/axel/esp/esp-idf/components/spi_flash/esp_flash_api.c:546

0x400fca7b: esp_partition_erase_range at /home/axel/esp/esp-idf/components/spi_flash/partition.c:531

0x400fb8ea: esp_ota_write at /home/axel/esp/esp-idf/components/app_update/esp_ota_ops.c:196

@vanwykc
Copy link

vanwykc commented Feb 18, 2022

I have encountered a similar issue.

When I run OTA, I get a Task WDT in ipc0 task.

I have only 3 of these custom prototype boards using ESP32-WROVER and this CPU crash occurs on 2 of the 3. The 3rd one runs the OTA without a hitch every single time.

This is my sdkconfig file

Find below the idf debug print outs for OTA FAILURE first and there after OTA SUCCESS (different device)

I've included the boot up prints to prove that processor silicon version etc is exactly the same.

I know that esp_ota_begin has an internal call for partition erase, but thought I'll call it separately to see if that helps, but still same result.

Any help provided would be greatly appreciated as this project is on a very strict deadline for end of Feb 2022

OTA FAILURE

I (73893) process_next_u_ota_packet: Try esp_ota_get_next_update_partition
I (73896) process_next_u_ota_packet: NEXT UPDATE PARTION INFO: type 0 subtype 16 address 0x00610000 size 0x00200000
I (73897) process_next_u_ota_packet: Try esp_partition_erase_range(ptr, 0, 2097152)
E (74103) ms4_event_handler_task: Waited more than 200 ms for AFE_All_Vals_Ready_Cnt to update from 327
I (77415) ms4_event_handler_task: new max_run_time_ms 1852
E (77621) ms4_event_handler_task: Waited more than 200 ms for AFE_All_Vals_Ready_Cnt to update from 328
E (79483) ms4_event_handler_task: Waited more than 200 ms for AFE_All_Vals_Ready_Cnt to update from 328
E (80109) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (80109) task_wdt:  - IDLE (CPU 0)
E (80109) task_wdt: Tasks currently running:
E (80109) task_wdt: CPU 0: ipc0
E (80109) task_wdt: CPU 1: IDLE
E (80109) task_wdt: Aborting.

abort() was called at PC 0x4013754a on core 0
0x4013754a: task_wdt_isr at /home/charl/esp/esp-idf/components/esp_common/src/task_wdt.c:182 (discriminator 1)


Backtrace:0x400925d6:0x3ffbf500 0x40092cdd:0x3ffbf520 0x400992f2:0x3ffbf540 0x4013754a:0x3ffbf5b0 0x40084721:0x3ffbf5d0 0x40082a27:0x3ffbb1c0 0x4008be2f:0x3ffbb1e0 0x4008bd12:0x3ffbb200
0x400925d6: panic_abort at /home/charl/esp/esp-idf/components/esp_system/panic.c:379

0x40092cdd: esp_system_abort at /home/charl/esp/esp-idf/components/esp_system/system_api.c:112

0x400992f2: abort at /home/charl/esp/esp-idf/components/newlib/abort.c:46

0x4013754a: task_wdt_isr at /home/charl/esp/esp-idf/components/esp_common/src/task_wdt.c:182 (discriminator 1)

0x40084721: _xt_lowint1 at /home/charl/esp/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:1105

0x40082a27: gpio_ll_clear_intr_status_high at /home/charl/esp/esp-idf/components/hal/esp32/include/hal/gpio_ll.h:270
 (inlined by) gpio_intr_service at /home/charl/esp/esp-idf/components/driver/gpio.c:454

0x4008be2f: spi_flash_op_block_func at /home/charl/esp/esp-idf/components/spi_flash/cache_utils.c:121

0x4008bd12: ipc_task at /home/charl/esp/esp-idf/components/esp_ipc/ipc.c:62



ELF file SHA256: ab783f7b7a8a44fa

I (8531) esp_core_dump_flash: Save core dump to flash...
I (8532) esp_core_dump_flash: Erase flash 24576 bytes @ 0xa10000
I (8811) esp_core_dump_flash: Write end offset 0x5280, check sum length 32
I (8811) esp_core_dump_flash: Core dump has been saved to flash.
Rebooting...
I (12) boot: ESP-IDF v4.3.1-dirty 2nd stage bootloader
I (13) boot: compile time 07:37:03
I (13) boot: chip revision: 3
I (13) boot.esp32: SPI Speed      : 40MHz
I (13) boot.esp32: SPI Mode       : DIO
I (14) boot.esp32: SPI Flash Size : 16MB
I (14) boot: Enabling RNG early entropy source...
I (15) boot: Partition Table:
I (16) boot: ## Label            Usage          Type ST Offset   Length
I (16) boot:  0 nvs              WiFi data        01 02 00009000 00400000
I (17) boot:  1 otadata          OTA data         01 00 00409000 00002000
I (18) boot:  2 phy_init         RF data          01 01 0040b000 00001000
I (19) boot:  3 factory          factory app      00 00 00410000 00200000
I (20) boot:  4 ota_0            OTA app          00 10 00610000 00200000
I (21) boot:  5 ota_1            OTA app          00 11 00810000 00200000
I (22) boot:  6 coredump         Unknown data     01 03 00a10000 00100000
I (23) boot: End of partition table
I (24) boot: Defaulting to factory image
I (24) esp_image: segment 0: paddr=00410020 vaddr=3f400020 size=2d918h (186648) map
I (93) esp_image: segment 1: paddr=0043d940 vaddr=3ffbdb60 size=026d8h (  9944) load
I (97) esp_image: segment 2: paddr=00440020 vaddr=400d0020 size=bc418h (771096) map
I (376) esp_image: segment 3: paddr=004fc440 vaddr=3ffc0238 size=06734h ( 26420) load
I (387) esp_image: segment 4: paddr=00502b7c vaddr=40080000 size=1ae20h (110112) load
I (432) esp_image: segment 5: paddr=0051d9a4 vaddr=50000000 size=00010h (    16) load
I (447) boot: Loaded app from partition at offset 0x410000
I (447) boot: Disabling RNG early entropy source...
I (448) psram: This chip is ESP32-D0WD
I (455) psram: PSRAM is in 2T mode
I (455) spiram: Found 32MBit SPI RAM device
I (455) spiram: SPI RAM mode: flash 40m sram 40m
I (455) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (456) cpu_start: Pro cpu up.
I (456) cpu_start: Starting app cpu, entry point is 0x400817a4
0x400817a4: call_start_cpu1 at /home/charl/esp/esp-idf/components/esp_system/port/cpu_start.c:141

I (451) cpu_start: App cpu up.
I (1336) spiram: SPI SRAM memory test OK
I (1345) cpu_start: Pro cpu start user code
I (1345) cpu_start: cpu freq: 240000000
I (1345) cpu_start: Application information:
I (1345) cpu_start: Project name:     ms4_esp32
I (1346) cpu_start: App version:      v0.195
I (1347) cpu_start: Compile time:     Feb 18 2022 12:02:33
I (1347) cpu_start: ELF file SHA256:  ab783f7b7a8a44fa...
I (1348) cpu_start: ESP-IDF:          v4.3.1-dirty
I (1349) heap_init: Initializing. RAM available for dynamic allocation:
I (1350) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1351) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1351) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1352) heap_init: At 3FFD1358 len 0000ECA8 (59 KiB): DRAM
I (1353) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1354) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1355) heap_init: At 4009AE20 len 000051E0 (20 KiB): IRAM
I (1356) spiram: Adding pool of 4081K of external SPI memory to heap allocator
I (1357) spi_flash: detected chip: generic
I (1358) spi_flash: flash io: dio
I (1359) esp_core_dump_flash: Init core dump to flash
I (1368) esp_core_dump_flash: Found partition 'coredump' @ a10000 1048576 bytes
I (1370) cpu_start: Starting scheduler on PRO CPU.
I (1) cpu_start: Starting scheduler on APP CPU.
I (1372) spiram: Reserving pool of 68K of internal memory for DMA/internal allocations

OTA SUCCESS

I (14) boot: ESP-IDF v4.3.1-dirty 2nd stage bootloader
I (14) boot: compile time 07:37:03
I (14) boot: chip revision: 3
I (14) boot.esp32: SPI Speed      : 40MHz
I (15) boot.esp32: SPI Mode       : DIO
I (15) boot.esp32: SPI Flash Size : 16MB
I (16) boot: Enabling RNG early entropy source...
I (17) boot: Partition Table:
I (17) boot: ## Label            Usage          Type ST Offset   Length
I (18) boot:  0 nvs              WiFi data        01 02 00009000 00400000
I (19) boot:  1 otadata          OTA data         01 00 00409000 00002000
I (20) boot:  2 phy_init         RF data          01 01 0040b000 00001000
I (21) boot:  3 factory          factory app      00 00 00410000 00200000
I (22) boot:  4 ota_0            OTA app          00 10 00610000 00200000
I (22) boot:  5 ota_1            OTA app          00 11 00810000 00200000
I (23) boot:  6 coredump         Unknown data     01 03 00a10000 00100000
I (24) boot: End of partition table
I (25) boot: Defaulting to factory image
I (25) esp_image: segment 0: paddr=00410020 vaddr=3f400020 size=2d918h (186648) map
I (94) esp_image: segment 1: paddr=0043d940 vaddr=3ffbdb60 size=026d8h (  9944) load
I (98) esp_image: segment 2: paddr=00440020 vaddr=400d0020 size=bc41ch (771100) map
I (377) esp_image: segment 3: paddr=004fc444 vaddr=3ffc0238 size=06734h ( 26420) load
I (388) esp_image: segment 4: paddr=00502b80 vaddr=40080000 size=1ae20h (110112) load
I (433) esp_image: segment 5: paddr=0051d9a8 vaddr=50000000 size=00010h (    16) load
I (448) boot: Loaded app from partition at offset 0x410000
I (448) boot: Disabling RNG early entropy source...
I (450) psram: This chip is ESP32-D0WD
I (460) psram: PSRAM is in 2T mode
I (460) spiram: Found 32MBit SPI RAM device
I (460) spiram: SPI RAM mode: flash 40m sram 40m
I (460) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (461) cpu_start: Pro cpu up.
I (461) cpu_start: Starting app cpu, entry point is 0x400817a4
0x400817a4: call_start_cpu1 at /home/charl/esp/esp-idf/components/esp_system/port/cpu_start.c:141

I (0) cpu_start: App cpu up.
I (1342) spiram: SPI SRAM memory test OK
I (1351) cpu_start: Pro cpu start user code
I (1351) cpu_start: cpu freq: 240000000
I (1351) cpu_start: Application information:
I (1351) cpu_start: Project name:     ms4_esp32
I (1352) cpu_start: App version:      v0.195
I (1352) cpu_start: Compile time:     Feb 18 2022 12:02:33
I (1353) cpu_start: ELF file SHA256:  4423b0844573b2d2...
I (1354) cpu_start: ESP-IDF:          v4.3.1-dirty
I (1355) heap_init: Initializing. RAM available for dynamic allocation:
I (1356) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (1356) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (1357) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (1358) heap_init: At 3FFD1358 len 0000ECA8 (59 KiB): DRAM
I (1359) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1359) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1360) heap_init: At 4009AE20 len 000051E0 (20 KiB): IRAM
I (1361) spiram: Adding pool of 4081K of external SPI memory to heap allocator
I (1363) spi_flash: detected chip: gd
I (1363) spi_flash: flash io: dio
I (1365) esp_core_dump_flash: Init core dump to flash
I (1374) esp_core_dump_flash: Found partition 'coredump' @ a10000 1048576 bytes
I (1375) cpu_start: Starting scheduler on PRO CPU.
I (1) cpu_start: Starting scheduler on APP CPU.
I (1378) spiram: Reserving pool of 68K of internal memory for DMA/internal allocations

.
.
.

I (65768) process_next_u_ota_packet: Try esp_ota_get_next_update_partition
I (65769) process_next_u_ota_packet: NEXT UPDATE PARTION INFO: type 0 subtype 16 address 0x00610000 size 0x00200000
I (65770) process_next_u_ota_packet: Try esp_partition_erase_range(ptr, 0, 2097152)
I (66766) process_next_u_ota_packet: Try esp_ota_begin
I (67377) process_next_u_ota_packet: <===== U_OTA START (total bytes: 1100080) =====>

@vanwykc
Copy link

vanwykc commented Mar 2, 2022

I've noticed that all my CPU crash reports had a common theme: task WDT failure in IPC task. Started browsing IPC related issues on ESP-IDF repo. Noticed this issue.

Tried to run my application in single core mode. Problem solved.

PLEASE can the ESP-IDF gurus have an in-depth look at SPI handling where IPC is involved? It seems like there is a serious issue there.

Although this single core functionality helps temporarily, I suspect that as our project grows, we would soon run out of processing power and would definitely require that second CPU to come online. So please let me know if there is any way how I can help speed up the root cause discovery.

@AxelLin
Copy link
Contributor Author

AxelLin commented Mar 3, 2022

I've noticed that all my CPU crash reports had a common theme: task WDT failure in IPC task. Started browsing IPC related issues on ESP-IDF repo. Noticed this issue.

Tried to run my application in single core mode. Problem solved.

I don't use bluetooth at all in my original report, so this is probably different from #3923.
But indeed I don't hit this issue if CONFIG_FREERTOS_UNICORE=y.
However, setting CONFIG_FREERTOS_UNICORE=y is not an acceptable solution.

PLEASE can the ESP-IDF gurus have an in-depth look at SPI handling where IPC is involved? It seems like there is a serious issue there.

I don't find any engineer involved in this thread and #3923 for so many months, so I don't expect this will be fixed soon.

@vanwykc
Copy link

vanwykc commented Mar 3, 2022

I don't find any engineer involved in this thread and #3923 for so many months, so I don't expect this will be fixed soon.

How can we escalate this to bring it to their attention?

@vanwykc
Copy link

vanwykc commented Mar 3, 2022

Spoke to another developer with extensive ESP32 experience regarding this. He said he never experienced issues like this BUT he has the habit of pinning tasks to cores instead of just letting them float around to the first available core. (thus instead of using xTaskCreate he uses xTaskCreatePinnedToCore).

Furthermore, his strategy is to pin all BLE, WiFi and Flash intensive tasks to core 0 and the rest to core 1 and then letting trivial processing tasks be unpinned (thus tskNO_AFFINITY)

His exact message to me in a Skype Chat was:

the issue is when you are interfacing with peripherals the cores need to switch that context over as well.. i read up early on when i did those battery monitors..(also heavy code ) that serial, network or any Io operation could cause contention

processing tasks i normally float between free cores..

you see the BLE and WIFI core are tied to a static core... apply the same methogogy i say

I tried it like that and worked!!! So my project is now back to dual core operation :)

@AxelLin
Copy link
Contributor Author

AxelLin commented Mar 3, 2022

Spoke to another developer with extensive ESP32 experience regarding this. He said he never experienced issues like this BUT he has the habit of pinning tasks to cores instead of just letting them float around to the first available core. (thus instead of using xTaskCreate he uses xTaskCreatePinnedToCore).

Furthermore, his strategy is to pin all BLE, WiFi and Flash intensive tasks to core 0 and the rest to core 1 and then letting trivial processing tasks be unpinned (thus tskNO_AFFINITY)

I would suggest to do the reverse and check if it's easier to reproduce the issue, then fix it properly. (If it's easy to reproduce, it has higher chance to fix the issue).

His exact message to me in a Skype Chat was:

the issue is when you are interfacing with peripherals the cores need to switch that context over as well.. i read up early on when i did those battery monitors..(also heavy code ) that serial, network or any Io operation could cause contention
processing tasks i normally float between free cores..
you see the BLE and WIFI core are tied to a static core... apply the same methogogy i say

I tried it like that and worked!!! So my project is now back to dual core operation :)

You may have less chance to hit the issue with above workaround.
But it's still possible to happen if the root cause is not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Selected for Development Issue is selected for development
Projects
None yet
Development

No branches or pull requests

6 participants