Sunday, 4 January 2015

Programming your Arduino with a USB asp

I recently bought a USB asp adapter in order to flash a stock bootloader on an Arduino UNO R3. I had flashed a bootloader that turns the Arduino into a USB Joystick device. I wanted to use the Arduino for a new purpose and realized that I could no longer flash the Arduino because it now identified itself as a joystick to my computer. At the time, I had only one Arduino UNO R3 to work with I decided I needed a dedicated tool to flash it. I bought the USB asp off of an ebay seller. It was cheap and came with little documentation.



First I had to figure out how to connect it to my Arduino. This is a straightforward matter of finding a mapping between the pins on the device and ISP header on the Arduino.

But, hooking it up is tedious work. I want to be able to plug it in simply, so I returned to ebay and found that a USB asp to Arduino ISP connector is available for cheap.


Now I can simply plug it in the ISP header on my Arduino when I need it.


Now I only need to remember which direction to plug it in. Fortunately, plugging it in the wrong direction seems to be a mistake without dire consequences for the Arduino.

When I tried to flash the bootloader onto the Arduino, I unfortunately got warnings and errors from avrdude. Note that I'm using Linux.

It turns out, that we need a udev rule to allow avrdude to read and write to the usb device. Here is an example rule that I added to a new file under /etc/udev/rules.d. 

/etc/udev/rules.d/99-usbasp.rules 

SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05dc", MODE="0666"

After restarting udev (sudo restart udev) amd plugging it the USBasp device, I was able to succesfully flash my Arduino.

It turns out that this device was also useful to use when I want to program a much older freeduino serial v1.0 from 1998. This early arduino clone doesn't have a FTDI chip and is finicky when programming it over a serial port. 

1 comment:

  1. Casino & Hotel Las Vegas - MapyRO
    사천 출장안마 › Vegas Casinos › › Vegas Casinos 전라북도 출장안마 3131 South 안성 출장마사지 Las Vegas Boulevard, Las 상주 출장샵 Vegas, NV 용인 출장샵 89109. star.atlas.com

    ReplyDelete