Thanks for the suggestion; I added the following to the esp_ping_thread()
Code: Select all
if (ep->on_ping_end) {
// Check stack usage
UBaseType_t uxHighWaterMark;
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );
ep->on_ping_end((esp_ping_handle_t)ep, (void *)uxHighWaterMark);
}
Then printed the high water mark in my on_ping_end callback:
Code: Select all
printf("%lu packets transmitted, %lu received, time %lums hwm=%u\r\n", transmitted, received, total_time_ms, (unsigned int)args);
With the default stack size (2048+512), the code generally fails:
Code: Select all
64 bytes from 69.147.92.12 icmp_seq=1 ttl=58 time=204 ms
64 bytes from 69.147.92.12 icmp_seq=2 ttl=58 time=279 ms
64 bytes from 69.147.92.12 icmp_seq=3 ttl=58 time=230 ms
64 bytes from 69.147.92.12 icmp_seq=4 ttl=58 time=521 ms
64 bytes from 69.147.92.12 icmp_seq=5 ttl=58 time=217 ms
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00060723 PS : 0x00060830 A0 : 0x8008b434 A1 : 0x3ffc9930
A2 : 0x3ffc8f90 A3 : 0x00000000 A4 : 0x3ffb36d0 A5 : 0x00060023
A6 : 0x00000001 A7 : 0x00000040 A8 : 0x80106e6c A9 : 0x3ffc9910
A10 : 0x3ffc8f90 A11 : 0x00000014 A12 : 0x3ffb0108 A13 : 0x0000001c
A14 : 0x3ffc8f90 A15 : 0x0000001c SAR : 0x0000001b EXCCAUSE: 0x00000014
EXCVADDR: 0x00060720 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffc
Backtrace: 0x00060720:0x3ffc9930 0x4008b431:0x3ffc9980
When I extend the stack by 64 bytes, it works and shows 20-28 bytes of stack remaining:
Code: Select all
ping_config.task_stack_size = 2624;
Code: Select all
64 bytes from 69.147.92.11 icmp_seq=1 ttl=58 time=218 ms
64 bytes from 69.147.92.11 icmp_seq=2 ttl=58 time=272 ms
64 bytes from 69.147.92.11 icmp_seq=3 ttl=58 time=231 ms
64 bytes from 69.147.92.11 icmp_seq=4 ttl=58 time=271 ms
64 bytes from 69.147.92.11 icmp_seq=5 ttl=58 time=231 ms
5 packets transmitted, 5 received, time 1223ms hwm=20