utzig commented on a change in pull request #2239: dialog_da1469x: enhance otp 
and serial loader tools.
URL: https://github.com/apache/mynewt-core/pull/2239#discussion_r392395095
 
 

 ##########
 File path: hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py
 ##########
 @@ -51,21 +52,32 @@ def load(infile, uart):
     # - If XOR matches, host sends 0x6 as final ack
     # - board boots image after receiving ACK from host
 
-#    if len(msg) == 0:
-#        raise SystemExit("Read timed out, exiting")
-
-    print("Please reset board to enter ROM uart recovery")
+    som_detected = False
+    reset_triggered = False
+    now = datetime.datetime.now()
+    reset_delay_us = 250000
 
     while True:
+        elapsed = datetime.datetime.now() - now
+        if elapsed.seconds >= 15:
+            raise SystemExit("Failed to receive SOM, aborting")
+        if not som_detected and not reset_triggered:
+            if elapsed.microseconds >= reset_delay_us:
+                print("Triggering SWD reset...")
+                os.system("./reset.sh &")
 
 Review comment:
   Doing this the script can only run `reset.sh` in the local directory, if I 
run it from repo root, eg, `./hw/bsp/dialog_da1469x-dk-pro/da1469x_serial.py`, 
it would not find the reset script. Not strictly required though.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to