board, hwconfig: Set POWER_EN in early boot #43
Reference in New Issue
Block a user
Delete Branch "fix-set-power-en-in-early-boot"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In order to turn the Tonberry device on more reliably even if the power
button is only pressed for a short time, move the setting of POWER_EN
pin to high from the python board_init to the MICROPY_BOARD_STARTUP
macro so that is is started in the C startup code run before the
micropython interpreter is initialized.
Measured time from power on to POWER_EN time was 600-800 ms with the
python board_init, vs. 155 ms for the MICROPY_BOARD_STARTUP.
I'm a bit surprised that it still takes so long until that macro is actually called 🤔
According to my research, this is because the time it takes to copy stuff from flash to ram (.data and the code we run from ram) in crt0 before we even get to main().