node-red access serial usb port thru /dev/ttyUSBxxx

Hi all

I manage to be able to declare an usb port with link as : /dev/ttyUSB300

But even if node-red seems to be connected to the port I didn’t get any data from it.

Thanks if you can help me, I certainly miss something…

lsusb | grep Future
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd

gedit /etc/udev/rules.d/70-enocean-stick.rules
SUBSYSTEM==“usb”, ATTRS{idVendor}==“0403”, ATTRS{idProduct}==“6001”, SYMLINK+=“ttyUSB300”

sudo chmod 777 /dev/ttyUSB300

sudo chmod a+w /dev/bus/usb/001/004

nvidia@ubuntu:/usr/lib/node_modules/node-red$ sudo chmod a+w /dev/bus/usb/001/004

nvidia@ubuntu:~$ sudo udevadm info /dev/ttyUSB300
P: /devices/3530000.xhci/usb1/1-2/1-2.1
N: bus/usb/001/004
S: ttyUSB300
E: BUSNUM=001
E: DEVLINKS=/dev/ttyUSB300
E: DEVNAME=/dev/bus/usb/001/004

E: DEVNUM=004
E: DEVPATH=/devices/3530000.xhci/usb1/1-2/1-2.1
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MM_DEVICE_MANUAL_SCAN_ONLY=1
E: ID_MODEL=FT232R_USB_UART
E: ID_MODEL_ENC=FT232R\x20USB\x20UART
E: ID_MODEL_FROM_DATABASE=FT232 Serial (UART) IC
E: ID_MODEL_ID=6001
E: ID_REVISION=0600
E: ID_SERIAL=FTDI_FT232R_USB_UART_A600AVMH
E: ID_SERIAL_SHORT=A600AVMH
E: ID_USB_INTERFACES=:ffffff:
E: ID_VENDOR=FTDI
E: ID_VENDOR_ENC=FTDI
E: ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
E: ID_VENDOR_ID=0403
E: MAJOR=189
E: MINOR=3
E: PRODUCT=403/6001/600
E: SUBSYSTEM=usb
E: TYPE=0/0/0
E: USEC_INITIALIZED=13512903
E: net.ifnames=0

It looks like the driver is doing as it should, and permissions are not an issue. FTDI devices in particular work quite well without fuss. What remains would most likely be a case of using matching settings on the port for the ttyUSB# and your device talking to the port.

I do not know what a node-red is, but is there a specification of what serial port speed, parity, stop bits, and flow control should be? Whatever that is needs to be set on the device special file as well…the two will need to match. If the values are far enough off, then nothing will get through; in other cases a closer setting (but still a mismatch) would imply garbage data passing.

Hi thanks for the answer,
node-red is a flow based programming tool using javascript modules. I already setup it thru windows and apply same configuration to the serial port module (speed parity and so one). Then I can cath all data flow comming thru the port.
Are you aware of any other way to cath serial data?

I am unsure of what you mean by “cath” serial data. Do you mean to catch, record, or save the communications? If so, then typically you’d use either a protocol analyzer or just a serial console program. The analyzer will tell you more, but the serial console program (such as gtkterm or minicom on Linux…or on Windows PuTTY) can be used to verify settings of a port (though beware if you run a program using a port then the program itself might changes settings).

One useful trick with a serial console is to loop back the single serial port and then see if what you type echoes back. You’d directly connect that port’s RX and TX, and if flow control is used, you’d directly wire its CTS and RTS lines together. This guarantees only the settings of the one device are being observed and there can never be a mismatch of a device from itself. If you do that on the serial port at both ends to verify each as having a given setting, then you can be more confident that when the two ports are talking to each other that you know settings are valid.

In the case of USB serial, if you are willing to go through a lot more effort, there are software means to watch the USB data flow (basically something like wireshark is used as a software traffic analyzer).

Thanks for the information I will try and keep informed.

regarding the issue,

node-red serial port module report that the serial dev/usb300 is connected so I will try to send information and check with wireshark the trace.

An other issue appear: if i reboot the TX2, I have to reissue the command: sudo chmod 777 /dev/ttyUSB300
as it seems that it is no more available to all acount. do you know how to fix that?

Best regards

if i reboot the TX2, I have to reissue the command: sudo chmod 777 /dev/ttyUSB300
as it seems that it is no more available to all acount. do you know how to fix that?

Yes, you add a “, MODE=0666” rule to the udev rule that names the device ttyUSB300.
777 is not needed, because you won’t be running the serial device as an executable.