Skip to content

Commit a373ab4

Browse files
committed
Double-reset for macOS
1 parent 37a079c commit a373ab4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

artemis_uploader/artemis_svl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ def upload_firmware(binfile, port, baud, timeout=0.5):
366366
entered_bootloader = False
367367

368368
# Instantiate ser here and set dtr and rts before opening the port
369-
# https://community.sparkfun.com/t/unable-to-flash-artemis-thing-plus-on-macos-sequoia/60766/6
370369
ser = serial.Serial()
371370
ser.port = port
372371
ser.baudrate = baud
@@ -377,6 +376,7 @@ def upload_firmware(binfile, port, baud, timeout=0.5):
377376
while (attempt < num_tries) and (bl_success == False):
378377

379378
# Set dtr and rts before opening the port
379+
# https://community.sparkfun.com/t/unable-to-flash-artemis-thing-plus-on-macos-sequoia/60766/6
380380
ser.dtr=False
381381
ser.rts=False
382382

artemis_uploader/asb/asb.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ def upload(args, verboseprint):
420420
#Auto-retry this number of times before we give up.
421421

422422
# Instantiate ser here and set dtr and rts before opening the port
423-
# https://community.sparkfun.com/t/unable-to-flash-artemis-thing-plus-on-macos-sequoia/60766/6
424423
ser = serial.Serial()
425424
ser.port = args.port
426425
ser.baudrate = useBaud
@@ -437,12 +436,22 @@ def upload(args, verboseprint):
437436

438437
ser.open()
439438

439+
# RTS behaves differently on macOS. Use a double-reset
440+
time.sleep(0.01)
441+
ser.dtr=False # Set RTS and DTR high
442+
ser.rts=False
443+
time.sleep(0.01)
444+
ser.dtr=True # Set RTS and DTR low
445+
ser.rts=True
446+
440447
time.sleep(0.008) #3ms and 10ms work well. Not 50, and not 0.
441448

442-
ser.dtr=False # Set RTS and DTR high
449+
# Set RTS and DTR high
450+
# This causes BOOT to go high - and then decay back to zero
451+
ser.dtr=False
443452
ser.rts=False
444453

445-
#Give bootloader a chance to run and check bootload pin before communication begins. But must initiate com before bootloader timeout of 250ms.
454+
#Give bootloader a chance to run and check BOOT pin before communication begins. But must initiate com before bootloader timeout of 250ms.
446455
time.sleep(0.1) # 100ms works well
447456

448457
ser.reset_input_buffer() # reset the input bufer to discard any UART traffic that the device may have generated

0 commit comments

Comments
 (0)