1

I'm trying to open a Serial communication between a Raspberry Pi 3 (model B, running on Raspbian) and a device (a traffic counter to be precise).

I've a USB to Serial cable, using the rs232 standard. (so I'm not using the GPIO)

My goal is to be able to open a serial communication between this device and my rpi3 using python and the pyserial library.

(on windows everything works fine, I open a COMx port and I can then communicate with the device)

My problem: When I plug my Serial to USB cable, the rpi3 don't even create a ttyUSB0 device. What is going on ? How could I open a serial communication in python ?

dmesg -w

[ 3482.730866] usb 1-1.4: new full-speed USB device number 9 using dwc_otg
[ 3482.891077] usb 1-1.4: New USB device found, idVendor=0403, idProduct=9bf0
[ 3482.891093] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3482.891102] usb 1-1.4: Product: TrafficCounter USB Adapter
[ 3482.891110] usb 1-1.4: Manufacturer: TrafficCounter
[ 3482.891118] usb 1-1.4: SerialNumber: FTVNFDLZ

If I run a

glob.glob('/dev/tty[A-Za-z]*')
I obtain:
['/dev/ttyS0', '/dev/ttyAMA0', '/dev/ttyprintk']

And I can see my device with lsusb:

lsusb

Bus 001 Device 009: ID 0403:9bf0 Future Technology Devices International, Ltd 

5 Answers 5

4

Personally I managed to have ttyUSB appear through raspi-config.

You just have to go to Interfaces Settings and say you want the serial port activated.

I hope it will help :)

1
  • Yes, that's good for me as well. I'm using an SMS dongle, lsusb gave a good result but the port wouldn't open. Did a reboot after port activation and /dev/ttyUSB0 is usable. Commented Mar 20, 2022 at 14:47
2

Thank's for your answers, unfortunately that did not resolve my problem.

I guess that ftdi_sio module do not support anymore the "vendor" and "product" attribute. So

modprobe ftdi_sio vendor=0x0403 product = 0x9bf0

Didn't work for me.

What worked:

I'v added my vendorid and productid in /sys/bus/usb-serial/drivers/ftdi_sio/new_id

sudo nano /sys/bus/usb-serial/drivers/ftdi_sio/new_id

and then i just add:

0403 9bf0

How to automate this process --> here

1
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Jan 23, 2020 at 10:49
1

/dev/ttyS0 and /dev/ttyAMA0 are inbuilt UARTS.

NOT all USB devices/drivers are "tty".

Unplug the device, list /dev then plug in and see what has changed.

1

I see you already solved the problem, but for the reference, I use the following script to debug problems on USB bus:

for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && exit
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && exit
        echo "/dev/$devname - $ID_SERIAL"
    )
done

Sample output:

/dev/input/event0 - 040b_GiGa_HiD
/dev/ttyUSB0 - 1a86_USB2.0-Serial
/dev/ttyACM0 - Arduino__www.arduino.cc
/dev/sdb - WD_Elements_2620
/dev/sdb1 - WD_Elements_2620
-1

You need to load the ftdi-sio module manually with modprobe and specifying vendor and product id, or follow the guidelines in their manual at

https://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_101_Customising_FTDI_VID_PID_In_Linux(FT_000081).pdf

Afterwards, you'll have a /dev/ttyUSBn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.