factory reset button not working

zliudr
Posts: 154
Joined: Thu Oct 03, 2019 5:15 am

factory reset button not working

Postby zliudr » Wed Jul 01, 2020 12:36 am

I am trying to make factory reset work but it's not working. OTA partition is loaded regardless the button being depressed.
I tested the buttons with my multimeter and read it within my firmware. When not held, it reads 1. When held, it reads 0. It's a simple button connecting pin 18 to ground.
I've set up the config as below:

Code: Select all

#
# Bootloader config
#
CONFIG_LOG_BOOTLOADER_LEVEL_NONE=
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=
CONFIG_LOG_BOOTLOADER_LEVEL_WARN=
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG=
CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE=
CONFIG_LOG_BOOTLOADER_LEVEL=3
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V=
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
CONFIG_BOOTLOADER_FACTORY_RESET=y
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=18
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
CONFIG_BOOTLOADER_DATA_FACTORY_RESET="nvs"
CONFIG_BOOTLOADER_APP_TEST=y
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=19
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=5
CONFIG_BOOTLOADER_WDT_ENABLE=y
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
CONFIG_APP_ROLLBACK_ENABLE=y
CONFIG_APP_ANTI_ROLLBACK=
Somehow it's not working.

Here is my partition list printed by 2nd stage bootloader:

Code: Select all

I (50) boot: ## Label            Usage          Type ST Offset   Length
I (58) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (65) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (73) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (80) boot:  3 factory          factory app      00 00 00010000 00200000
I (88) boot:  4 ota_0            OTA app          00 10 00210000 00200000
I (95) boot:  5 ota_1            OTA app          00 11 00410000 00200000
I (103) boot:  6 storage          Unknown data     01 82 00610000 00900000
I (110) boot: End of partition table
I (114) esp_image: segment 0: paddr=0x00210020 vaddr=0x3f400020 size=0x545bc (345532) map
I (245) esp_image: segment 1: paddr=0x002645e4 vaddr=0x3ffb0000 size=0x03ba8 ( 15272) load
I (251) esp_image: segment 2: paddr=0x00268194 vaddr=0x40080000 size=0x00400 (  1024) load
I (252) esp_image: segment 3: paddr=0x0026859c vaddr=0x40080400 size=0x07a74 ( 31348) load
I (273) esp_image: segment 4: paddr=0x00270018 vaddr=0x400d0018 size=0xf6a48 (1010248) map
I (628) esp_image: segment 5: paddr=0x00366a68 vaddr=0x40087e74 size=0x116c0 ( 71360) load
I (673) boot: Loaded app from partition at offset 0x210000
As you can see, ota_0 got selected to run.

Here's some more printouts where I held down test button on GPIO19.

Code: Select all

I (151) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (151) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (161) __MAIN__: GPIO18: 1     GPIO19:0
GPIO18 reads correctly as well. I am using ESP_IDF release 3.3
Any help? Thanks.

Who is online

Users browsing this forum: No registered users and 16 guests