Page 1 of 1

WDT reset due to flash access lock-up

Posted: Sun Oct 07, 2018 8:07 pm
by 0xffff
Hi,

I'm running ESP32 w/ 2 CPUs. Occasionally, I get a WDT resest:

Code: Select all

W (85) boot: PRO CPU has been reset by WDT.
W (85) boot: WDT reset info: PRO CPU PC=0x40084d50
W (86) boot: WDT reset info: APP CPU PC=0x40088214
Looking at the two addresses in gdb:

Code: Select all

(gdb) list *0x40084d50
0x40084d50 is in spi_flash_op_block_func (/proj/Firmware/esp-idf/components/spi_flash/./cache_utils.c:82).
77	    // s_flash_op_complete flag is cleared on *this* CPU, otherwise the other
78	    // CPU may reset the flag back to false before IPC task has a chance to check it
79	    // (if it is preempted by an ISR taking non-trivial amount of time)
80	    s_flash_op_complete = false;
81	    s_flash_op_can_start = true;
82	    while (!s_flash_op_complete) {
83	        // busy loop here and wait for the other CPU to finish flash operation
84	    }
85	    // Flash operation is complete, re-enable cache
86	    spi_flash_restore_cache(cpuid, s_flash_op_cache_state[cpuid]);
(gdb) list *0x40088214
0x40088214 is in vTaskExitCritical (/proj/Firmware/esp-idf/components/freertos/./tasks.c:4278).
4273	#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
4274			vPortCPUReleaseMutexIntsDisabled( mux, function, line );
4275	#else
4276			vPortCPUReleaseMutexIntsDisabled( mux );
4277	#endif
4278			if( xSchedulerRunning != pdFALSE )
4279			{
4280				TCB_t *tcb = pxCurrentTCB[xPortGetCoreID()];
4281				BaseType_t nesting = tcb->uxCriticalNesting;
4282				if( nesting	 > 0U )
So it seems that the PRO CPU hangs waiting for the APP CPU to give up the access to the flash, but seems the task scheduler state is stuck at taskSCHEDULER_NOT_STARTED? I have at least a half-dozen tasks running - is it one of my tasks that is causing issues? Any ideas on debugging this?

Thanks

Re: WDT reset due to flash access lock-up

Posted: Mon Oct 15, 2018 5:04 pm
by 0xffff
Someone from ESP? Help? :)

Re: WDT reset due to flash access lock-up

Posted: Tue Oct 16, 2018 2:45 am
by ESP_Sprite
Hard to say, and your symptoms don't really ring a bell - are you sure this isn't caused by e.g. memory corruption? Any chance you can whittle your code down to the smallest example that gives you this behaviour?