@@ -378,11 +378,17 @@ def upload(args, verboseprint):
378
378
connection_timeout = 5
379
379
380
380
print ('Connecting over serial port {}...' .format (args .port ), flush = True )
381
- print ('Baud rate:' ,args .baud )
381
+ print ('Requested baud rate:' ,args .baud )
382
+
383
+ useBaud = int (args .baud )
384
+ if (useBaud > 115200 ):
385
+ print ('Limiting baud rate to 115200' )
386
+ useBaud = 115200
387
+ useBaud = str (useBaud )
382
388
383
389
#Check to see if the com port is available
384
390
try :
385
- with serial .Serial (args .port , args . baud , timeout = connection_timeout ) as ser :
391
+ with serial .Serial (args .port , useBaud , timeout = connection_timeout ) as ser :
386
392
pass
387
393
except :
388
394
@@ -417,7 +423,7 @@ def upload(args, verboseprint):
417
423
# https://community.sparkfun.com/t/unable-to-flash-artemis-thing-plus-on-macos-sequoia/60766/6
418
424
ser = serial .Serial ()
419
425
ser .port = args .port
420
- ser .baudrate = args . baud
426
+ ser .baudrate = useBaud
421
427
ser .timeout = connection_timeout
422
428
423
429
loadTries = 0
@@ -431,13 +437,13 @@ def upload(args, verboseprint):
431
437
432
438
ser .open ()
433
439
434
- time .sleep (0.01 ) #3ms and 10ms work well. Not 50, and not 0.
440
+ time .sleep (0.008 ) #3ms and 10ms work well. Not 50, and not 0.
435
441
436
442
ser .dtr = False # Set RTS and DTR high
437
443
ser .rts = False
438
444
439
445
#Give bootloader a chance to run and check bootload pin before communication begins. But must initiate com before bootloader timeout of 250ms.
440
- time .sleep (0.15 )
446
+ time .sleep (0.1 ) # 100ms works well
441
447
442
448
ser .reset_input_buffer () # reset the input bufer to discard any UART traffic that the device may have generated
443
449
0 commit comments