Close

ZeptoProg AVR Programmer

ZeptoProg AVR Programmer

Just recently I upgraded my computer, which meant no more parallel port. So I needed a USB method of uploading new firmwares to Atmel AVR mcu’s. (This will also enable me to use my laptop as well for AVR programming.) To this end, I purchased the ZeptoProg AVR Programmer from Mattair Tech, LLC.

It was not without challenges however, one being the permissions under Ubuntu 10.04 for usb devices. Read on for more info about how I solved this using the udev permissions file /etc/udev/user.rules file.

 

I may run AVR Studio 4 under wine, but for now I’m using avrdude.

So for an example, at first when I plugged in the ZeptoProg AVR programmer, and pressed the “A” button to select AVR programming mode, I entered the avrdude command to read an Atmega8 chip, and got this:

dynamo@dynamo-ubuntu:~$ avrdude -c avrisp2 -p m8 -P usb -U flash:r:"flash.hex":ravrdude: usb_open(): cannot read serial number "error sending control message: Operation not permitted"
avrdude: usb_open(): cannot read product name "error sending control message: Operation not permitted"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Operation not permitted
avrdude: usbdev_open(): did not find any USB device "usb"
dynamo@dynamo-ubuntu:~$

 

Humph. So after a lot of digging around on the internet and not finding much specific to my version of Ubuntu, I found this to work:

 

sudo nano /etc/udev/user.rules

 

And then I added in that file this line:

 

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", MODE="0666"

 

 

And after saving and closing the file, this command:

 

dynamo@dynamo-ubuntu:~# sudo service udev restart
udev start/running, process 21010
dynamo@dynamo-ubuntu:~#

 

Now, any time I plug in the device, it gets proper permissions for my non-root user to interact with the ZeptoProg device.

 

 

Now of course, you may ask, how did I determine what values to enter into the /etc/udev/user.rules file? Well it was tricky…first I listed the devices in /dev/bus/usb/001:

dynamo@dynamo-ubuntu:~$ ll /dev/bus/usb/001
total 0
drwxr-xr-x 2 root root 160 2011-04-15 09:28 ./
drwxr-xr-x 8 root root 160 2011-04-12 12:02 ../
crw-rw-r-- 1 root root 189, 0 2011-04-12 16:02 001
crw-rw-r-- 1 root root 189, 2 2011-04-12 16:02 003
crw-rw-r-- 1 root root 189, 3 2011-04-12 16:02 004
crw-rw-r-- 1 root root 189, 4 2011-04-12 16:02 005
crw-rw-r--+ 1 root lp 189, 5 2011-04-14 21:18 006
crw-rw-r-- 1 root root 189, 111 2011-04-15 09:28 112
dynamo@dynamo-ubuntu:~$

 

By trial and error I determined the ZeptoProg was the last device, because it would disappear when unplugged, and reappear with a higher number each time, in this case 112.

 

And then, with the device plugged in, I ran this:

 

udevadm info -a -p `udevadm info -q path -n /dev/bus/usb/001/112`

 

and a lot of information was printed, beginning with this:

 

Udevadm info starts with the device specified by the devpath and then

walks up the chain of parent devices. It prints for every device

found, all possible attributes in the udev rules key format.

A rule to match, can be composed by the attributes of the device

and the attributes from one single parent device.

 

looking at device ‘/devices/pci0000:00/0000:00:12.2/usb1/1-4/1-4.4’:

KERNEL==”1-4.4″

SUBSYSTEM==”usb”

DRIVER==”usb”

ATTR{configuration}==””

ATTR{bNumInterfaces}==” 1″

ATTR{bConfigurationValue}==”1″

ATTR{bmAttributes}==”c0″

ATTR{bMaxPower}==”200mA”

ATTR{urbnum}==”10″

ATTR{idVendor}==”03eb”

ATTR{idProduct}==”2104″

ATTR{bcdDevice}==”0200″

ATTR{bDeviceClass}==”ff”

ATTR{bDeviceSubClass}==”00″

ATTR{bDeviceProtocol}==”00″

ATTR{bNumConfigurations}==”1″

ATTR{bMaxPacketSize0}==”16″

ATTR{speed}==”12″

ATTR{busnum}==”1″

ATTR{devnum}==”112″

ATTR{version}==” 1.10″

ATTR{maxchild}==”0″

ATTR{quirks}==”0x0″

ATTR{authorized}==”1″

ATTR{manufacturer}==”MattairTech LLC”

ATTR{product}==”ZeptoProg AVR Programmer”

ATTR{serial}==”0000A00128255″

 

The key bits of information from this info for the /etc/udev/user.rules file are these:

 

SUBSYSTEM==”usb”

ATTR{idVendor}==”03eb”

 

These identify to the udev service what to do when a new device is added, which is to assign the read/write permissions to all users.

 

Maybe this can be helpful to you!

 

Many thanks to Mattair Tech, LLC for their great ZeptoProg AVR programmer.

 

 

screenshot, udevadm, ZeptoProg

Comments

Copyright 2020 dansworkshop.com