Soft Reboot and SPI

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
PM-TPI
Posts: 75
Joined: Fri Jun 28, 2019 3:09 pm

Soft Reboot and SPI

Post by PM-TPI » Wed Jul 06, 2022 7:57 pm

# vspi = causes a reboot

Code: Select all

MPY: soft reboot
boot
SmartLOG Start
power latched...
tft backlight set...
Initialize WiFi
WiFi... Activated
Initialize BLE
Bluetooth... Activated
Ambient Sensor... Activated
  # vspi = SPI(2, miso=Pin(19), mosi=Pin(23), sck=Pin(18))   causes.....
E (41926) spi_master: spi_master_deinit_driver(270): not all CSses freed
assertion "atomic_load(&lock->dev[i]) == (intptr_t)NULL" failed: file "/mnt/c/SmartLOG/FW/Build/esp-idf/components/driver/spi_bus_lock.c", line 560, function: spi_bus_deinit_lock

abort() was called at PC 0x401eebe0 on core 0
I am not able to use any file upload tools like mpremote, rshell, and others

see...
https://github.com/dhylands/rshell/issues/27
Apparently this soft-reset maintains the raw REPL status and does not revert to friendly REPL.
But since my ESP32 crashes on the soft reset because the ili9341 driver doesn't cleanly unload,
it doesn't get a raw REPL when it expects one.
I tried the -s version of rshell and it works!!!
But I would need to modify every tool.
I'd rather fix the cause... soft rest causes reboot

and also...
ESP32 - SPI not being reset across soft-reset #4103
https://github.com/micropython/micropython/issues/4103
@dpgeorge
esp32/machine_hw_spi: Make HW SPI objects statically allocated. …
da72bb6
This aligns more closely with the hardware, that there are two, fixed HW
SPI peripherals. And it allows to recreate the HW SPI objects without
error, as well as create them again after a soft reset.

Fixes issue #4103.
I am using 1.17, should have the fix.

Any suggestions or help greatly appreciated !!!

Post Reply