Skip to main content

Update to USBmicroISP: 6pin and 10pin headers

Actually using my USBmicroISP with microcontrollers other than Arduino Uno's led me to fix a udev rule issue with my Gentoo Linux laptop.  I was getting Permission Denied when I was trying to use avrdude as a normal user.  Yes, my user is part of the 'uucp' group...

Background

Some background on the Arduino ISP connector.  It is much different than the 10-pin AVR connector...
6-pin ICSP cable pinout.  NOTE: Numbers refer to ATtiny45/85 pins, not ICSP!

Arduino ISP pinout. Notice the vertical line next to pin 1, which appears in silkscreen on the PCBs.

Redboard ISP pinout.  Obviously the same as UNO.  Notice pin 1 location on upper-left, with horizontal white silk.

My USBmicroISP has the cables coming off the IDC differently, but the key is in the correct orientation to the pinout in the top picture! (Please disregard numbering on first picture for ICSP purposes)  Usually the key and wires are facing inward (left side on 2nd and 3rd picture) on an Arduino UNO R3 (and Redboard, clones, etc)

Possible improvements to USBmicroISP:

  • Add a 3.3V regulator jumper switch (and 300mA reg), so we can toggle between powering 5V target, powering 3.3V target, or no powering (target uses own power).
  • Add 2 different colored LEDs (green for 5V, orange for 3.3V), or bi-color (!)
  • Consolidate 2 headers into 1 connector and cable, with two IDCs at the tail end, with some fancy twists between the AVR 10-pin and the Arduino 6-pin.
  • Update to USB-C connector (!)

Using USBmicroISP with avrdude

The real work begins.  I start following this Adafruit guide to check connectivity with my Zigbit board:
https://learn.adafruit.com/usbtinyisp/avrdude

In /etc/udev/rules.d/10-usbtinyisp.rules:
SUBSYSTEM=="usb", ATTR{product}=="USBtiny", ATTR{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE="0660", GROUP="uucp"
or whatever your defined group is for USB programmers/Arduino stuff.

Restart the systemd-udevd.service for systemd users.  Or just plain old udev for openrc guys.

Frustrating:::
         Using Port                    : /dev/parport0
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 002:008
avrdude: Warning: cannot open USB device: Permission denied
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

avrdude done.  Thank you.

Seems my udev rules aren't working...

Debug, follow

http://weininger.net/how-to-write-udev-rules-for-usb-devices.html

sonyVAIO ~ # udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/002/008)

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:1d.0/usb2/2-1/2-1.5':
    KERNEL=="2-1.5"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{bDeviceSubClass}=="00"
    ATTR{bDeviceProtocol}=="00"
    ATTR{devpath}=="1.5"
    ATTR{idVendor}=="1781"
    ATTR{speed}=="1.5"
    ATTR{bNumInterfaces}==" 1"
    ATTR{bConfigurationValue}=="1"
    ATTR{bMaxPacketSize0}=="8"
    ATTR{busnum}=="2"
    ATTR{devnum}=="8"
    ATTR{configuration}==""
    ATTR{bMaxPower}=="100mA"
    ATTR{authorized}=="1"
    ATTR{bmAttributes}=="80"
    ATTR{bNumConfigurations}=="1"
    ATTR{maxchild}=="0"
    ATTR{bcdDevice}=="0104"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{quirks}=="0x0"
    ATTR{version}==" 1.01"
    ATTR{urbnum}=="8"
    ATTR{ltm_capable}=="no"
    ATTR{removable}=="unknown"
    ATTR{idProduct}=="0c9f"
    ATTR{bDeviceClass}=="ff"
    ATTR{product}=="USBtiny"

sonyVAIO ~ # udevadm test /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5

[...] MODE 0664 /lib64/udev/rules.d/50-udev-default.rules:38
device 0x7fc6c3510350 filled with db file data
handling device node '/dev/bus/usb/002/008', devnum=c189:135, mode=0664, uid=0, gid=85
preserve permissions /dev/bus/usb/002/008, 020664, uid=0, gid=85
preserve already existing symlink '/dev/char/189:135' to '../bus/usb/002/008'
created db file '/run/udev/data/c189:135' for '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5' [...]

Hmm, not working.  Trying changing groups to "adm", "users".  Try changing mode to "0666".  Noticing that gid is not getting set to "100" with rule setting GROUP to "users".  Find note about how a rule could get overridden.  Try using ":=" instead of "=" for GROUP setting.  Bingo!  

Also, my file priority is only 10.  Try changing this to 50-usbtinyisp.rules.  Yes, this effects it.  

I have my gid=14 for "uucp".

Final 50-usbtinyisp.rules setting

SUBSYSTEM=="usb", ATTRS{product}=="USBtiny", GROUP="uucp"

Don't need MODES, just set the group! (and make sure your user is in the group) Careful of those equal signs!


USER access to USBmicroISP works:
sony@sonyVAIO ~ $ avrdude -c usbtiny -p m8

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Finally!

avrdude-5.11.1 didn't have support for my Zigbit (Atmega256RFR2), so I got the latest, 6.3.

~JWilly

Comments

Popular posts from this blog

Atmega328PB Dev on Linux x64

The Atmega328PB is the greatest thing to come to the Arduino platform since the UNO.  Who wouldn't want more 16-bit PWMs and double all 3 serial protocols? The new unofficial Arduino Mini PB Pro! To get the IDE to support it, follow this guide: https://github.com/watterott/ATmega328PB-Testing Since the JSON file is incomplete for Linux, do the manual toolchain replacement.  This was a little tricky, and there isn't much on the internet on where the toolchain resides inside the Arduino base folder.  Here's what I did to make it work. I downloaded the latest Arduino build, and I will refer to the extracted base directory as "arduino-1.6.9".  Also download the "hardware.zip" and the "Arduino Toolchain (4.9.2)" Linux x64 version from the github links. 1. Replace the toolchain The builtin toolchain resides in "arduino-1.6.9/hardware/tools/avr/".  Rename the avr folder to "avr.old".  Extract the "Arduino Toolc

PB Pro Mini

No, it isn't Lead, nor is it Peanut Butter.  It is the 'B' version of the prolific ATmega328P microcontroller which started all this maker craziness off! Top view of PB Pro Mini Description This is a minimal microcontroller board with only a voltage reg, crystal, I2C pull-ups, LEDs and the chip itself.  The goal here is to reduce costs while hosting the beefy 328PB! This is based on, and pin compatible with, the Arduino Pro Mini 5v/16MHz from  Sparkfun . Notable, not-so-minor improvements for the 'B' version: 2 UARTs 2 I2Cs (TWI) 2 SPI Qtouch 5 Timers (with OC, IC, and PWM) Everything else is about the same.  You should be aware the clock driver on the chip is a low-power version, but this board and crystal operate at 16MHz just fine at 5V.  The Arduino library I've been using for the PB has been working without a problem! Getting Started You'll need a FTDI Friend  or FTDI Cable  to program this as there is no secondary USB