Get previous running partition

mbastida
Posts: 7
Joined: Wed Jul 06, 2022 6:55 am

Get previous running partition

Postby mbastida » Mon Apr 17, 2023 2:21 pm

Hi, we have an aplication where we need to boot from a FACTORY/OTA partition into a TEST partition by reading a GPIO input.

So when, for example, we are on FACTORY, OTA0 or OTA1 and detect the GPIO trigger we set esp_set_boot_partition() to the TEST partition and restart to apply changes.

The problem comes when we are in TEST partition. Again, if the GPIO is triggered the boot partition should be set to the one that was running before. Is there an already implemented way of doing this? How should I do it anyhow?

I'm aware of this: https://docs.espressif.com/projects/esp ... t-firmware
but due to a HW design error that GPIO pin is active high and not active low as this API expects. I supose this cannot be changed(?).

But using this function as an example. From the link I posted I need to implement this functionality myself:
Once the GPIO input is released (allowing it to be pulled up) and the device has been reboot, the normally configured application will boot (factory or any OTA app partition slot).

mbastida
Posts: 7
Joined: Wed Jul 06, 2022 6:55 am

Re: Get previous running partition

Postby mbastida » Mon Apr 17, 2023 2:27 pm

Com on espressif, you can do better!:
https://docs.espressif.com/projects/esp ... -pin-level

You could at least mention it here: https://docs.espressif.com/projects/esp ... t-firmware :)

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Get previous running partition

Postby ESP_Sprite » Tue Apr 18, 2023 1:37 am

Good catch; I think that config option was added later and they missed the reference in the earlier docs. I'll make an issue for the docs team to fix this.

Who is online

Users browsing this forum: Google [Bot] and 80 guests