Reading uart messages through usb

Hello,

I have a device that reads information from a sensor and sends it to my Apalis iMX6 via a serial 2 USB port, how could I access this serial port as I would on a standard OS?

I have read Romain’s question about this, which is the same problem, but his solution was to use the FTDI driver available on his colibri board. Is it possible to do this on a Apalis iMX6 + Ixora v1.1 board?

It depends on chip in your USB-to-serial adapter. Support of FTDI chip is included in our LXDE 2.8 image and it maps to /dev/ttyUSBx. However your USB-to-serial adapter can use other chips like CH340 etc. Just plug it to your Ixora board and check dmsg and lsusb output.

Hello @alex.tx thanks for your response.

This is the notificaton that appears when I plug the usb in:

[  119.432920] usb 2-1.2: new full-speed USB device number 4 using ci_hdrc
lsusb

And this is the output of lsbus before pluging the usb:

Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

And after:

Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
Bus 002 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It seems that it is using USB device number 4 and uses a CP210x family controller, now that I know this, what would be the way to access the data arriving from the UART?

What device you are plugging? GSM modem?

No, it is an Arduino board with which I want to be able to communicate to through USB.
The thing that may be interfering here is the Qualcomm device, which is a LTE module that uses 4 USB modems (/dev/ttyUSB0 … /dev/ttyUSB3) but I am not entirely shure about this

CP210x driver is not included in our image. Please follow this article to enable it.

Hi @alex.tx I’ve followed your advice and included the driver to a new image, and now when I plug the device the SO creates a ttyUSB4 instance on the /dev directory that is linked to it. My goal is to take the data from there and publish it to a MQTT broker running on the machine, what would be the correct aproach to achieve that? is there a way to read the data using a python script, for example? Thanks!

Yes you can access serial port from Python script using PySerial - https://pyserial.readthedocs.io/en/latest/shortintro.html

Hey @alex.tx, this package works nice, thanks for your help! I apreciate it

Perfect that it works. Thanks very much for the feedback.