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
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
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>
This commit is contained in:
@@ -25,3 +25,12 @@ int mp_hal_is_pin_reserved(int n);
|
||||
#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i)
|
||||
|
||||
#define MICROPY_PY_THREAD (0)
|
||||
|
||||
#define TONBERRY_POWER_EN 22
|
||||
|
||||
#define MICROPY_BOARD_STARTUP() \
|
||||
{ \
|
||||
gpio_init(TONBERRY_POWER_EN); \
|
||||
gpio_set_dir(TONBERRY_POWER_EN, true); \
|
||||
gpio_put(TONBERRY_POWER_EN, true); \
|
||||
}
|
||||
|
||||
@@ -41,10 +41,8 @@ VBAT_ADC = Pin.board.GP26
|
||||
|
||||
|
||||
def board_init():
|
||||
# Keep power turned on
|
||||
# POWER_EN turned on in MICROPY_BOARD_STARTUP
|
||||
# TODO: Implement soft power off
|
||||
POWER_EN.init(mode=Pin.OUT)
|
||||
POWER_EN.value(1)
|
||||
|
||||
# Set 8 mA drive strength and fast slew rate for SD SPI
|
||||
machine.mem32[0x4001c004 + 6*4] = 0x67
|
||||
|
||||
Reference in New Issue
Block a user