Serial terminal under Linux

The dataTaker DT8xG Geologgers for geotechnical applications

Serial terminal under Linux

Postby smilauer » Sat Aug 11, 2018 4:54 am

Hi,
I solved a problem on communication between DT80g (and likely also other DTx) and Linux OS using standard serial terminal. You can send text commands and receive output in the same way as with DeTransfer or in dEX command window but conveniently from Linux environment. This solution was tested on Ubuntu 16.04 but should work on other Linux-based systems as well. Here are the details.

Suppose you have a standard serial cable USB type B and USB type A supplied with DTx. Once you plug this cable into your computer with running DTx, it recognizes the device. You can find idVendor and idProduct by entering
Code: Select all
dmesg 

and get something like
Code: Select all
Aug  2 10:22:41 kostice kernel: [ 1122.612334] usb 2-1.3: New USB device found, idVendor=0403, idProduct=d000

Now we need to assign a driver to this device. My DT80g uses standard FTDI chip (and I assume this is in other DTx as well) but idProduct is changed so it is not recognized automatically by standard kernel modul ftdi_sio which is a policy of those manufactureres. The solution is assigning kernel module straight to the DTx device's chip. Just make sure you have installed libftdi from a package manager which provides that module ftdi_sio. To inject idVendor and idProduct to the module (driver), enter with your idVendor and idProduct
Code: Select all
echo "0403 d000" > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

Now plug again and check the status
Code: Select all
dmesg

Code: Select all
Aug  2 10:22:42 kostice kernel: [ 1123.128609] usb 2-1.3: New USB device found, idVendor=0403, idProduct=d000
Aug  2 10:22:42 kostice kernel: [ 1123.128618] usb 2-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug  2 10:22:42 kostice kernel: [ 1123.128625] usb 2-1.3: Product: DT80G-4 112056
Aug  2 10:22:42 kostice kernel: [ 1123.128630] usb 2-1.3: Manufacturer: dataTaker
Aug  2 10:22:42 kostice kernel: [ 1123.132285] ftdi_sio 2-1.3:1.0: FTDI USB Serial Device converter detected
Aug  2 10:22:42 kostice kernel: [ 1123.132355] usb 2-1.3: Detected FT232BM
Aug  2 10:22:42 kostice kernel: [ 1123.133105] usb 2-1.3: FTDI USB Serial Device converter now attached to ttyUSB0


Congratulation, your DTx is attached to /dev/ttyUSB0. To make ftdi_sio loading automatic, add the following file /etc/udev/rules.d/99-ftdi.rules with the content
Code: Select all
ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="d000", RUN+="/sbin/modprobe ftdi_sio", RUN+="/bin/sh -c 'echo 0403 d000 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'"

and reload with
Code: Select all
udevadm control --reload

You can check that unplug/plug loads ftdi_sio module every time using dmesg. Further details can be found
http://www.leniwiec.org/en/2014/06/25/ubuntu-14-04lts-how-to-pass-id-vendor-and-id-product-to-ftdi_sio-driver/ or https://unix.stackexchange.com/questions/67936/attaching-usb-serial-device-with-custom-pid-to-ttyusb0-on-embedded

The second part attaches serial terminal to /dev/ttyUSB0. I like CuteCom http://cutecom.sourceforge.net/ which is installable from a package manager. You need to enter only location /dev/ttyUSB0, hit "Open device". You may enter commands and receive outputs in the same way as in DeTransfer or in dEX command window. Here is a screenshot
CuteCom.jpg
CuteCom.jpg (41.88 KiB) Viewed 69 times

It is also possible to upload a text file with a DTx script, just to make sure you choose "Plain". Enjoy :D .
smilauer
Newbie
 
Posts: 2
Joined: Tue Aug 07, 2018 7:05 pm

Re: Serial terminal under Linux

Postby Rudy Gunawan » Wed Aug 15, 2018 4:38 pm

Thanks for the information Smilauer

dataTaker can be accessed by any terminal program.

Best regards,
Rudy Gunawan
Rudy Gunawan
Guru
 
Posts: 461
Joined: Sun Apr 29, 2012 12:28 am


Return to DT8xG

Who is online

Users browsing this forum: No registered users and 1 guest

cron