Getting Arduino Uno Clone with CH340B to work on Linuxmint 19


 Please consider donate through My Amazon Wishlist

Just got sometime to upgrade my Dell T3600 and HP Probook 4520s to Linuxmint 19 and everything almost worked flawlessly.

While going through setting up my ardruino development environments. I encountered a problem. So, I will share it here.

Thing are looking much better for CH340 chipset support on Linuxmint 19. It almost worked right out of the box on my Dell T3600 desktop machine with the default ch341 kernel module. No more messing around with custom building CH34x module from source.

All that is needed on Dell T3600 is adding yourself to dialout group using the following command and you are ready to go.

sudo usermod -aG dialout $USER

On my HP Probook 4520s laptop, however I am still getting permission issue. I remember I added self to dialup group on this laptop earlier when I setup USBasp. Some how I am still see the following error.

avrdude: Warning: cannot open USB device: Permission denied

This can easily fixed by finding out the idVendor and idProduct of the Uno board when it is attached.

$ lsusb
Bus 002 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Then create a udev rule.

sudo vim “/etc/udev/rules.d/99-CH340-USB-Serial.rules”

with the following rule

SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", GROUP="dialout"

Then add self to dialout user group.

sudo usermod -aG dialout $USER

Then logoff and login again.

Unplug your Uno clone then restart udev.

sudo /etc/init.d/udev restart

Reconnect your Uno device.

$ ls -l /dev/ttyU*
crw-rw—- 1 root dialout 188, 0 Nov 30 10:48 /dev/ttyUSB0

Sketch upload through USB should now work once you select the proper board and port:

Board: Arduino/Genuino Uno
Port: /dev/ttyUSB0

There are time after reflash the bootloader from Arduino 1.8.7, 1.8.8 menu. After which when you try to upload sketch you get this funky error.

Using Port                    : /dev/ttyUSB0
Using Programmer              : arduino          
Overriding Baud Rate          : 115200
avrdude: stk500_recv(): programmer is not responding 
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

This can be resolved by using USBasp and Arduino 1.0.6 to reflash the bootloader. My USBasp v2 has usbasp.atmega8.2011-05-28.hex firmware installed.

~/arduino-1.0.6/hardware/tools/avrdude -C~/arduino-1.0.6/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -cusbasp -Pusb -Uflash:w:~/arduino-1.0.6/hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex:i -Ulock:w:0x0F:m

After checking for differences in optiboot_atmega328.hex they are identical in 1.0.6 and 1.8.8 releases. The only differences is the avrdude used. In 1.0.6 the./arduino-1.0.6/hardware/tools was used where as in 1.8.8 the ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin

 

One thought on “Getting Arduino Uno Clone with CH340B to work on Linuxmint 19”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s