소스 검색

AT32F4: Fixes for manual firmware update (jumper method)

Keir Fraser 3 년 전
부모
커밋
fb340075ca
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 1
      scripts/greaseweazle/tools/info.py
  2. 6 3
      src/fw_update.c

+ 2 - 1
scripts/greaseweazle/tools/info.py

@@ -54,7 +54,8 @@ def main(argv):
         sys.exit(0)
 
     mode_switched = (usb.jumperless_update
-                     and usb.update_mode != args.bootloader)
+                     and usb.update_mode != args.bootloader
+                     and not (usb.update_mode and usb.update_jumpered))
     if mode_switched:
         usb = util.usb_reopen(usb, args.bootloader)
         

+ 6 - 3
src/fw_update.c

@@ -249,7 +249,11 @@ static bool_t check_update_strapped(void)
 
 static bool_t check_update_strapped(void)
 {
-    int i, j;
+    int i;
+
+    /* Enable SysTick counter. */
+    stk->load = STK_MASK;
+    stk->ctrl = STK_CTRL_ENABLE;
 
     /* Check whether the Serial TX/RX lines (PA9/PA10) are strapped. */
 #if MCU == STM32F7
@@ -262,8 +266,7 @@ static bool_t check_update_strapped(void)
     gpio_configure_pin(gpioa, 10, GPI_pull_up);
     for (i = 0; i < 10; i++) {
         gpio_write_pin(gpioa, 9, i&1);
-        for (j = 0; j < 10000; j++)
-            cpu_relax();
+        early_delay_us(100);
         if (gpio_read_pin(gpioa, 10) != (i&1))
             return FALSE;
     }