I've been using the pyserial library to talk with my Arduinos without issue on my year old mac mini. I bought a new mac mini last week, which apparently has usb 3.0 ports by default now, and I'm having no luck talking to my Arduinos. I get this message each time I attempt to talk to my serial devices on the new mac:
ser_dev = serial.Serial(port, timeout=TIMEOUT, writeTimeout=TIMEOUT, baudrate=9600)
File "/Library/Python/2.7/site-packages/serial/serialutil.py", line 282, in __init__
self.open()
File "/Library/Python/2.7/site-packages/serial/serialposix.py", line 289, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 16] Resource busy: '/dev/tty.usbmodem1314171'
I can take my Arduino to my old computer, plug it in, execute the same commands and it connects perfectly.
Does anyone have a guess as to what could be going on here? It seems to be a hardware difference. I'm using the same version of python, pyserial, and OS X on both computers.
Update:
I was able to get it to work by changing the baud rate from 9600 to 115200. Maybe that's a strange requirement of USB 3.0, I'm not sure. It's only able to see my USB devices every-other attempt, however. Any guess on this?
config = {}
config['timeout'] = 0.1
config['writeTimeout'] = 0.1
config['baudrate'] = 115200
with serial.Serial('/dev/cu.usbmodem1314171', **config) as x:
x.write('*idn?\n')
print x.readlines()