Failed to reconnect serial monitor after uploading on macOS

Apple Mac OSX
hanyazou
Posts: 43
Joined: Fri May 05, 2017 2:38 am

Re: Failed to reconnect serial monitor after uploading on macOS

Post by hanyazou » Wed May 24, 2017 11:00 pm

RogerClark wrote:Have you tried a variation of @danieleff's suggestion, as posted to the PR by @ag123 ( on github ) ?
I didn't try that on Windows, if you mean this @danieleff's post.
http://www.stm32duino.com/viewtopic.php ... =10#p28452

I made the patch for mac and I tested with my BP.
http://www.stm32duino.com/viewtopic.php ... 107#p28441


User avatar
RogerClark
Posts: 7478
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Failed to reconnect serial monitor after uploading on macOS

Post by RogerClark » Thu May 25, 2017 10:42 am

I've updated all the Maple upload scripts with @danieleff's suggested fix

I'm not sure if it will cause problems for Rick if he is not using the Arduino Serial Terminal, but the worst case should just be a short delay (timeout)

hanyazou
Posts: 43
Joined: Fri May 05, 2017 2:38 am

Re: Failed to reconnect serial monitor after uploading on macOS

Post by hanyazou » Thu May 25, 2017 12:18 pm

Sorry for late reply. I get back home now.
But my mac and blue-pill requires this change.

Code: Select all

  echo -n Waiting for ${dummy_port_fullpath} serial...
  
  COUNTER=0
  while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do
      sleep 0.1
  done
  
+ sleep 0.3
  echo Done
It makes this error if you delete the 'sleep 0.3'.

Code: Select all

processing.app.SerialException: Error opening serial port '/dev/cu.usbmodem14321'.
	at processing.app.Serial.<init>(Serial.java:141)
	at processing.app.Serial.<init>(Serial.java:78)
	at processing.app.SerialMonitor$3.<init>(SerialMonitor.java:95)
	at processing.app.SerialMonitor.open(SerialMonitor.java:95)
	at processing.app.AbstractMonitor.resume(AbstractMonitor.java:110)
	at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2207)
	at processing.app.Editor.access$2200(Editor.java:78)
	at processing.app.Editor$DefaultExportHandler.run(Editor.java:2173)
	at java.lang.Thread.run(Thread.java:745)
Caused by: jssc.SerialPortException: Port name - /dev/cu.usbmodem14321; Method name - openPort(); Exception type - Port busy.
	at jssc.SerialPort.openPort(SerialPort.java:164)
	at processing.app.Serial.<init>(Serial.java:130)
	... 8 more
Error opening serial port '/dev/cu.usbmodem14321'.

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: Failed to reconnect serial monitor after uploading on macOS

Post by danieleff » Thu May 25, 2017 1:52 pm

Can you check changing -c to -r?

hanyazou
Posts: 43
Joined: Fri May 05, 2017 2:38 am

Re: Failed to reconnect serial monitor after uploading on macOS

Post by hanyazou » Thu May 25, 2017 2:09 pm

No. It fails also if it lacks 'sleep 0.3'

Code: Select all

COUNTER=0
while [ ! -r ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do
  sleep 0.1
done
#sleep 0.3

User avatar
RogerClark
Posts: 7478
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Failed to reconnect serial monitor after uploading on macOS

Post by RogerClark » Thu May 25, 2017 9:28 pm

I wonder if this is all Macs or just one specific model.

If its all Macs the additional sleep could be added to the Mac script, but 0.3 may not be enough for slow machines.

What CPU speed etc is your Mac, and what version of OSX are you using.

I have an old machine running Yosemite that I can test with, but I dont have time at the moment

hanyazou
Posts: 43
Joined: Fri May 05, 2017 2:38 am

Re: Failed to reconnect serial monitor after uploading on macOS

Post by hanyazou » Fri May 26, 2017 12:14 pm

My mac is iMac late 2012 3.4GHz Intel Core i7 and OS version is Mac OSX 10.12.4.

This works well on my Mac.

Code: Select all

echo -n wait for ${dummy_port_fullpath}...
COUNTER=0
while ! dd if=${dummy_port_fullpath} of=/dev/null count=0 > /dev/null 2>&1 && ((COUNTER++ < 40)); do
  sleep 0.1
done
echo done.

ag123
Posts: 799
Joined: Thu Jul 21, 2016 4:24 pm

Re: Failed to reconnect serial monitor after uploading on macOS

Post by ag123 » Fri May 26, 2017 8:20 pm

i'm not too sure if /usr/bin/test or /bin/test exists on macos, but i'd guess

Code: Select all

[ ! -r ${dummy_port_fullpath} ]
is basically

Code: Select all

test ! -r ${dummy_port_fullpath}
?
using dd seem to be checking if you are able to copy from the file, which probably works but looks a little unorthodox :)
and it would seem a little unusual "[ ! -r ${dummy_port_fullpath} ]" didn't seem to work on macos, i.e. check that the file exists and is readable

User avatar
RogerClark
Posts: 7478
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Failed to reconnect serial monitor after uploading on macOS

Post by RogerClark » Fri May 26, 2017 9:35 pm

hanyazou wrote:My mac is iMac late 2012 3.4GHz Intel Core i7 and OS version is Mac OSX 10.12.4.

This works well on my Mac.

Code: Select all

echo -n wait for ${dummy_port_fullpath}...
COUNTER=0
while ! dd if=${dummy_port_fullpath} of=/dev/null count=0 > /dev/null 2>&1 && ((COUNTER++ < 40)); do
  sleep 0.1
done
echo done.
Excellent

My machines running MacOS are much much slower.one machine is 2Ghz dual core, and core i5 and one core i3

Post Reply