Update. Solved.
It turns out the esp-idf (currently on v4.2.1) fails to restart if it has a bad rtc crystal/load capacitance and its enabled.
The first issue is the fact the toolchain locks up when trying to reboot, the ironic work around for this increasing the logging verbosity to either DEBUG or VERBOSE in the sdkconfig. This at least allows the application to run as expected.
The second issue, though on my side was I had bad load capacitance on my crystal. This was immediately confirmed by placing a scope probe on the xtal XP pin (pin 13 on the pic-d4). This would increase the capacitance on the load and the crystal would begin to oscillate. This was further confirmed to be the issue as when the
esp_restart() function is called, the mcu stops. Once I place my probe on the XP capacitor, the crystal oscillates and the MCU then restarts as expected, holding the probbe on the capacitor and go through multiple of the same operations results in the expected outcomes.
Note to readers, my scope probe is roughly 7pF. My crystal has a load capacitance of 12.5. The ESP32-Pico-D4 as an input IO capacitance of 2pf. Plugging this into the target forumal gives:
Code: Select all
Load Capacitance = (12.5-2)*2 ~=21pF
the 22pF capacitors I have on hand are close enough, and this solved my issue.