Federico Fuga

Engineering, Tech, Informatics & science

Not all Arduino Nanos Are Built Equals

17 Nov 2022 10:19 CET

Not all Arduino Nanos are built equals. I have two samples here, one bought from AZDelivery and one in a NanoCUL. Though both are Nano v3s, they are somhow different.

Indeed, I was able to program the second out of the box using avrdude, while I had some issue with other.

Using PlatformIO I noticed that the first was not properly configured on my system. Indeed lsusb shows different chips are used:

The first has a ch340 chip:

$ lsusb
Bus 001 Device 007: ID 1a86:7523 QinHeng Electronics CH340 serial converter

the other has a FT232 and works out of the box.

$ lsusb
Bus 001 Device 008: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

The first requires a change in the confiuguration file, as explained by some platform.io message.

curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo udevadm control --reload-rules
sudo udevadm trigger

This will download the platform.io udev configuration file into /etc/udev/rules.d, that will correctly configure the device nodes when plugged, reload the udev rules and retrigger the daemon.

This is enough for most of the case, except for this specific device that use the CH340 chip. In this case, the device node ttyUSBx is not created because another udev rule is “stealing” it bysetting the USB config to #1. This appears in the syslog:

Nov 16 18:20:40 p53 kernel: [31029.950550] usb 1-6.4: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
Nov 16 18:20:40 p53 kernel: [31029.951195] ch341-uart ttyUSB1: ch341-uart converter now disconnected from ttyUSB1
Nov 16 18:20:40 p53 kernel: [31029.951206] ch341 1-6.4:1.0: device disconnected

In this case you can either uninstall brltty or modify the udev rule:

sudo nano /usr/lib/udev/rules.d/85-brltty.rules 
# Device: 1A86:7523
# Baum [NLS eReader Zoomax (20 cells)]
ENV{PRODUCT}=="1a86/7523/*", ENV{BRLTTY_BRAILLE_DRIVER}="bm", GOTO="brltty_usb_run"

Search for these lines and remove or comment the last one:

# ENV{PRODUCT}=="1a86/7523/*", ENV{BRLTTY_BRAILLE_DRIVER}="bm", GOTO="brltty_usb_run"

This will make the proper ttyUSBx device be created and the Arduino nano work as expected.