board, hwconfig: Set POWER_EN in early boot #43

Merged
matthias merged 1 commits from fix-set-power-en-in-early-boot into main 2025-10-14 21:09:07 +00:00
Owner

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.

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.
matthias self-assigned this 2025-10-13 21:23:44 +00:00
matthias added 1 commit 2025-10-13 21:23:45 +00:00
board, hwconfig: Set POWER_EN in early boot
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m42s
Check code formatting / Check-C-Format (push) Successful in 8s
Check code formatting / Check-Python-Flake8 (push) Successful in 10s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 9s
Run pytests / Check-Pytest (push) Successful in 11s
902ce980af
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.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
matthias requested review from stefank 2025-10-13 21:23:45 +00:00
Member

I'm a bit surprised that it still takes so long until that macro is actually called 🤔

I'm a bit surprised that it still takes so long until that macro is actually called 🤔
stefank approved these changes 2025-10-14 20:00:37 +00:00
Author
Owner

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().

> 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().
matthias merged commit 231172f794 into main 2025-10-14 21:09:07 +00:00
matthias deleted branch fix-set-power-en-in-early-boot 2025-10-14 21:09:07 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TonBERRY/tonberry-pico#43