I am trying to connect a Atmel XMega-A1 Xplained board to the RPi via USB and reading out data with Python (PySerial). OS is Wheezy-Raspbian. After trying a lot of different things, I'm out of suggestions. Please see if I have forgotten anything.
My question is really just "why can't I open the port?"
This is my Python code:
import serial print "dev" #debug dev = serial.Serial() print "settings.." #debug dev.port = '/dev/ttyACM0' dev.baudrate = 9600 dev.parity = serial.PARITY_NONE dev.bytesize = serial.EIGHTBITS dev.stopbits = serial.STOPBITS_ONE print "dev.open():" #debug dev.open() print "dev.open() = open!" #debug value = None while not value: value = dev.readline() print value
This gives me this open error:
Traceback (most recent call last): File "usb2.py", line 20, in <module> dev.open() File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 278, in open raise SerialException("could not open port %s: %s" % (self._port, msg)) serial.serialutil.SerialException: could not open port /dev/ttyACM0: [Errno 5] Input/output error: '/dev/ttyACM0'
I am a member of the dialout group
pi@raspberrypi ~/vs $ whoami pi pi@raspberrypi ~/vs $ groups pi adm dialout cdrom sudo audio video plugdev games users netdev input
Running the script with or without sudo gives the same outcome. When connecting the USB this is the outcome of dmesg:
[ 57.604335] usb 1-1.2: new full-speed USB device number 5 using dwc_otg [ 57.707605] usb 1-1.2: New USB device found, idVendor=03eb, idProduct=2122 [ 57.707634] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 57.707651] usb 1-1.2: Product: XPLAINED CDC [ 57.707663] usb 1-1.2: Manufacturer: ATMEL [ 57.707675] usb 1-1.2: SerialNumber: 056007012069 [ 57.780344] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device [ 57.868478] usbcore: registered new interface driver cdc_acm [ 57.868509] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
I followed this and installed picocom. Output of "picocom /dev/ttyACM0":
pi@raspberrypi ~/vs $ picocom /dev/ttyACM0 picocom v1.7 port is : /dev/ttyACM0 flowcontrol : none baudrate is : 9600 parity is : none databits are : 8 escape is : C-a local echo is : no noinit is : no noreset is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv imap is : omap is : emap is : crcrlf,delbs, FATAL: cannot open /dev/ttyACM0: Input/output error
Again, sudo makes no difference.
This is my first post so let me know if this is too verbose. Thanks!