pandad: support GPIO recovery when in bootstub (#28090)

pandad: recover when in bootstub

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh
2023-05-03 20:27:32 -07:00
committed by GitHub
parent 177ca52e76
commit 8a6312ef14
2 changed files with 5 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ def flash_panda(panda_serial: str) -> Panda:
panda = Panda(panda_serial)
fw_signature = get_expected_signature(panda)
internal_panda = panda.is_internal() and not panda.bootstub
internal_panda = panda.is_internal()
panda_version = "bootstub" if panda.bootstub else panda.get_version()
panda_signature = b"" if panda.bootstub else panda.get_signature()
@@ -39,7 +39,7 @@ def flash_panda(panda_serial: str) -> Panda:
if panda.bootstub:
bootstub_version = panda.get_version()
cloudlog.info(f"Flashed firmware not booting, flashing development bootloader. Bootstub version: {bootstub_version}")
cloudlog.info(f"Flashed firmware not booting, flashing development bootloader. {bootstub_version=}, {internal_panda=}")
if internal_panda:
HARDWARE.recover_internal_panda()
panda.recover(reset=(not internal_panda))
@@ -95,7 +95,7 @@ def main() -> NoReturn:
panda_serials = Panda.list()
if len(panda_serials) == 0:
if first_run:
cloudlog.info("Resetting internal panda")
cloudlog.info("No pandas found, resetting internal panda")
HARDWARE.reset_internal_panda()
time.sleep(2) # wait to come back up
continue

View File

@@ -581,8 +581,9 @@ class Tici(HardwareBase):
gpio_set(GPIO.STM_RST_N, 1)
gpio_set(GPIO.STM_BOOT0, 1)
time.sleep(2)
time.sleep(1)
gpio_set(GPIO.STM_RST_N, 0)
time.sleep(1)
gpio_set(GPIO.STM_BOOT0, 0)