Open DavidVentura opened 4 months ago
Are you aware of SEGGER sysview? If you add CONFIG_APPTRACE_SV_ENABLE=y
in the sdkconfig.default, and connect openocd via jtag to the esp, or using uart, you can pipe that output into the sysview application and see what is happening on the esp. To select the cpu to trace you can set either CONFIG_APPTRACE_SV_DEST_CPU_0=y
or CPU_1
. For more look here and here.
Also probably best to not use Duration since its a "relative" expansive operation for perf checking. You also may want to look at low level C
based calls like -> this though we currently not exporting the esp_hw_support component in esp-idf-sys, though its simple to add.
I was not aware of sysview, this would help debugging :grin: sadly I'm unable to get my sdkconfig.defaults
file picked up when using cargo build
. I also am not aware of how to use the equivalent of idf.py menuconfig
in a 'cargo-first' project
On the Duration
- I know it's not the cheapest, but it's clear when seeing a 3us pause that that's too much for a clock measurement.
make sure you read this as the sdkconfig is definitely working, you may just need to adjust your setup according to the linked docs
that worked for sdkconfig. I'll try and debug what's causing the interrupts with apptrace. To be clear, the issue happens on the mininal example where there is no user code on Core1
I couldn't get apptrace to give me anything at all, I tried a few things blindly and didn't get an improvement;
CONFIG_ESP_WIFI_EXTRA_IRAM_OPT=y
CONFIG_ESP_WIFI_RX_IRAM_OPT=y
CONFIG_ESP_WIFI_IRAM_OPT=y
CONFIG_RMT_ISR_IRAM_SAFE=y
iram1
llink sectionApparently, the RMT driver stores its current affinity when created, and will later spawn a thread (?) based on that affinity; the current ThreadSpawnConfiguration
is not taken into account for that configuration.
Creating the RMT driver on Core1 solves the issue; though it would be nice if this was documented (at least I couldn't find it)
I've been having issues running a task that uses the RMT peripheral -- everything was fine until I enabled Wifi, now I'm seeing interrupts.
I've prepared a minimal example which just measures elapsed time between two operations - when an interrupt fires in this interval the measurement shows >3us.
Minimal reproducer:
on Core 0, I'm getting ~93 interruptions per second (this is expected).
Changing that code to use Core1, I'd expect 0, but instead I'm getting 1/2 per second: (note the timestamps)
I've tried to use
xTaskCreatePinnedToCore
directly, and there's no real difference (same interrupts)I've also tried guarding the measurements with a critical section, but it also did not help:
what can I do to ensure the code running on code 0 is not interrupted by the Wifi interrupts?