From cc835ed8ff6193ba4813b5b61ac82a5a0a0e0f3d Mon Sep 17 00:00:00 2001 From: Dario Pennisi Date: Wed, 5 Aug 2020 14:58:47 -0400 Subject: [PATCH] added system reset to bootloader command for portenta --- src/omv/usbdbg.c | 8 ++++++++ src/omv/usbdbg.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/omv/usbdbg.c b/src/omv/usbdbg.c index 91970aa30..77180210a 100644 --- a/src/omv/usbdbg.c +++ b/src/omv/usbdbg.c @@ -328,6 +328,14 @@ void usbdbg_control(void *buffer, uint8_t request, uint32_t length) NVIC_SystemReset(); break; + case USBDBG_SYS_RESET_TO_BL:{ + RTC_HandleTypeDef RTCHandle; + RTCHandle.Instance = RTC; + HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0xDF59); + NVIC_SystemReset(); + break; + } + case USBDBG_FB_ENABLE: { xfer_bytes = 0; xfer_length = length; diff --git a/src/omv/usbdbg.h b/src/omv/usbdbg.h index 3909128d0..0816ea67f 100644 --- a/src/omv/usbdbg.h +++ b/src/omv/usbdbg.h @@ -46,6 +46,7 @@ enum usbdbg_cmd { USBDBG_ATTR_READ =0x8A, USBDBG_ATTR_WRITE =0x0B, USBDBG_SYS_RESET =0x0C, + USBDBG_SYS_RESET_TO_BL =0x0E, USBDBG_FB_ENABLE =0x0D, USBDBG_TX_BUF_LEN =0x8E, USBDBG_TX_BUF =0x8F,