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...
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:
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.
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/avrdudeIn /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
~JWilly
Comments
Post a Comment