I have a custom nRF52840 board that I am implementing the Open Bootloader (from SDK 15.3). Push Button/Power control is handled by the STM6601 device. It keeps the power ON only when the PSHOLD line is kept HIGH. PSHOLD is driven by a GPIO.
The problem is that most methods to call the Bootloader use a reset, which causes the GPIO's to all go to inputs. This causes PSHOLD to go LOW, turning the power off. Even calling the Bootloader code directly seems to cause this behavior.
I can't use a strong pull-up resistor because I also want to use the STM6601 feature where it turns the power back off if the MCU doesn't set PSHOLD within a certain time.
--> Note that this is only ever called when the board is plugged into the Host's USB port.
I have come up with the following work-around:
- Set the NRF_POWER->GPREGRET to BOOTLOADER_DFU_START to call the Bootloader on reset.
- Call nrf_power_system_off() to put the MCU into System Off mode.
- The system immediately resets, but preserves the GPIO state, and enters the bootloader.
While this process seems reliable, I would like to know exactly what's going on. I assume it's to do with the presence of Vbus.
Any suggestions?