Skip to content

Commit 53836aa

Browse files
committed
Add double-reset for bootloader update on macOS
1 parent 9417303 commit 53836aa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

artemis_uploader/asb/asb.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,20 @@ def upload(args, verboseprint):
421421
with serial.Serial(args.port, args.baud, timeout=connection_timeout) as ser:
422422
#DTR is driven low when serial port open. DTR has now pulled RST low.
423423

424-
time.sleep(0.008) #3ms and 10ms work well. Not 50, and not 0.
424+
time.sleep(0.01) #3ms and 10ms work well. Not 50, and not 0.
425425

426426
#Setting RTS/DTR high causes the bootload pin to go high, then fall across 100ms
427427
ser.setDTR(0) #Set DTR high
428428
ser.setRTS(0) #Set RTS high - support the CH340E
429429

430+
time.sleep(0.01) #A double-reset seems to work best on macOS
431+
ser.setDTR(1)
432+
ser.setRTS(1)
433+
434+
time.sleep(0.01)
435+
ser.setDTR(0)
436+
ser.setRTS(0)
437+
430438
#Give bootloader a chance to run and check bootload pin before communication begins. But must initiate com before bootloader timeout of 250ms.
431439
time.sleep(0.100) #100ms works well
432440

0 commit comments

Comments
 (0)