Updating firmware on USBASP bought from eBay

I bought a cheap USBASP clone Atmel programmer from eBay a few weeks ago, to use with the Arduino IDE. (see images below)

The board worked ok, but kept giving errors

avrdude: warning: cannot set sck period. please check for usbasp firmware update

and I was unable to program an ATTiny85 on a breadboard when running at 3.3v (it worked fine at 5V), so I decided to bite the bullet and attempt to update the firmware on the USBASP using one of my Arduino boards as the programmer.

There appears to be a lot of misleading and confusing information on the web about how to do this, so I thought I’d document what worked for me.

  1. NOTE. Attempting to reprogram your USBASP may damage or erase it. Only follow the process described below if you are willing to take this risk ;-)
  2. Program an Arduino UNO as an ISP.
    This is a fairly simple process.
    Plug in your Arduino.
    From the Examples (on the File menu). Select “Arduino ISP”
    Select “Upload” and confirm that the new firmware has been uploaded.

    Note down the Comm port that the Arduino board is connected via i.e from the Tools->Serial port menu

  3. Download the lastest version of the USBASP firmware from http://www.fischl.de/usbasp
    I used usbasp.2011-05-28.tar.gz
    unzip the file and note the full path of the  the bin/firmware directory for the firmware you have just downloaded and unzipped
  4. Open a command prompt (windows cmd ), and Cd to your Arduino program folder and then into the hardware\tools\avr\bin folder
    This folder should contain the avrdude.exe that will be used to flash the new firmware.
  5. Link the Self Program jumper on the USBASP – on my board this was labeled J2, some other boards are different.
    I had to solder the pins onto the PCB as they were missing, and used a jump link, but any way to reliably connect the Self Program pins should work fine.
  6. Connect the Arduino to the programming pins of the USBASP
    Make sure you disconnect the USBASP from your computers USB

    My connections were
    Arduino    USBASP

    5V ———– 2
    GND ——– 10
    13 ———— 7
    12  ———-  9 (MISO)
    11 ———-   1 (MOSI)
    10 ———    5 (RESET)

    usbasp_and_arduino

  7. Check that avrdude can connect to the USBASP

    In the windows command window, type

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -v

    Note if your Arduino is not on COM3 you need to change this to whatever your Arduino IDE used.

    If everything is connected correctly you should see a load of information about the USBASP board that you are about to program, like this

    Using Port                    : COM3
    Using Programmer              : avrisp
    Overriding Baud Rate          : 19200
    AVR Part                      : ATMEGA8
    Chip Erase delay              : 10000 us
    PAGEL                         : PD7
    BS2                           : PC2
    RESET disposition             : dedicated
    RETRY pulse                   : SCK
    serial program mode           : yes
    parallel program mode         : yes
    Timeout                       : 200
    StabDelay                     : 100
    CmdexeDelay                   : 25
    SyncLoops                     : 32
    ByteDelay                     : 0
    PollIndex                     : 3
    PollValue                     : 0×53
    Memory Detail                 :

    Block Poll               Page                       Polled
    Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
    ———– —- —– —– —- —— —— —- —— —– —– ———
    eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
    flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0×00
    lfuse          0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    hfuse          0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    lock           0     0     0    0 no          1    0      0  2000  2000 0×00 0×00
    calibration    0     0     0    0 no          4    0      0     0     0 0×00 0×00
    signature      0     0     0    0 no          3    0      0     0     0 0×00 0×00

    Programmer Type : STK500
    Description     : Atmel AVR ISP
    Hardware Version: 2
    Firmware Version: 1.18
    Topcard         : Unknown
    Vtarget         : 0.0 V
    Varef           : 0.0 V
    Oscillator      : Off
    SCK period      : 0.1 us

    avrdude: AVR device initialized and ready to accept instructions

  8. If you get an error message about invalid signature, your board is may not use an ATMega8, and you will need to change the -p option on the AVRDUDE command to match you board. If you omit the -p option, AVRDUDE will display a list of compatible devices and their codes which you can use to select the correct device.

    If you have the correct device, but still get a signature error, check that you are using -c avrisp and NOT -c arduino.
    Using -c arduino tells AVRDUDE that you want to program the Arduino board and not the USBASP

    If you can’t connect at all, check your wiring, as its possible that some boards don’t have the same pinout as my board.

  9. Assuming that AVRDUDE can connect to the USBASP, you can backup the original firmware using the command

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:r:original_firmware.bin:r

    This should read the firmware and save it to a file called original_firmware.bin (in the same folder as avrdude.exe)

  10. As a double check you can attempt to write the original firmware back to the device, I’m not sure if this is a foolproof way of testing whether you can flash the USBASP but I did it as a test, as previously I’d had issues writing / flashing the device but was able to read it OK.

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:original_firmware.bin

    If this appears to work and AVRDUDE verifies OK, then its probably safe to attempt to burn the new firmware.

    In my case the new firmware was in c:\usbasp so the command was

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega8.2011-05-28.hex

    Note. If the chip on your USBASP is not a MEGA8, you need to use the correct / matching file e.g.

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega88.2011-05-28.hex

  11. If the process worked ok and AVDRUDE verified the new firmware, you can disconnect the USBASP from the Arduino and connect it via USB to the PC and attempt to program your target device (using the Arduino IDE or AVRDUDE).

 

 

usbasp programmer uspasp bottom view

Visual Studio 2012 C# x86 console application

Just a quick post to help anyone else in the same situation…

I needed to write a simple console application in C# (to receive serial data and save it to a file), but found that when I copied the application to the Windows XP (SP2) target machine, that it didn’t run and I got the “Not a valid Win32 Application” error message.

Searching on the web I found numerous postings about how Visual Studio 2012 could no longer target XP, but that VS2012 Update 1 had a fix for this, in the project configurations. But these config’s are not present on a C# build and seem to be specific to C++.

Anyway, the actual solution was to change the CPU type from “Any” to X86 (my target machine is X86), and this changed the error on the XP machine to an error for not having .Net 4.5 installed.

But .Net 4.5 was not available for XP at the time of writing, and the machine already had .Net 4.0 installed.

However switching the VS project to use .Net 4 didn’t immediately appear to fix the problem, until I realised that it was necessary to completely quit VS and restart it, in order for the settings changes to the project to be registered. (VS closes and re-opens the project when you change .Net versions, but this doesn’t seem to reset everything in VS2012 (update 2)).

Anyway, I finally got the app working on target machine.

Initial impressions of Adobe’s “CreateJS Toolkit”

I spent several hours today looking at Adobe’s new Flash -> HTML5 converter called “CreateJS Toolkit” (see http://www.adobe.com/au/products/flash/flash-to-html5.html )

The premise is that Flash content, (graphics, animation and sound) can be exported for use with the CreateJS suite of open-source frameworks ( https://github.com/CreateJS ).

The “Toolkit” its self is a Flash extension. Its only compatible with Flash CS6, however I suspect this is purely a marketing limitation, as Flash CS5 can save to XFL so I doubt that the plugin uses any new functionality in CS6.

I have attempted to “Publish” several of existing FLA files  to HTML using the tool and they have all failed.

Read the rest of this entry »

Solar Position Explorer app now available in the App Store

Solar Position Explorer app now available in the App Store.

See https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=600320388&mt=8

Sun Position Explorer

 

Personal Wiki with HTML Export has been approved into the App Store.

The new version of Personal Wiki which includes HTML Export has been approved into the App Store.

https://itunes.apple.com/us/app/personal-wiki/id574995802?mt=8

This release also includes some bug fixes and enhancements.

  • Page should correctly scroll to location of first tap as keyboard is opened – when entering edit mode.
  • On new pages, the “Type some text about…” message, is automatically removed when the screen is tapped to enter edit mode.
  • More validation was added to the Wiki name, so that wiki’s called just white space characters are no longer allowed.
  • Crash bug, when opening Pages popup (only every found in Apple’s testing), has been fixed.

Personal Wiki is still free to download, at the current time, and don’t have any plans to charge or include adverts, because of the large amount additional tax paperwork that is required in Australia (by Apple), to produce paid apps, (or apps that get revenue from adverts).

Solar Position Explorer app – awaiting App Store Approval.

My latest education all. Sun Position Explorer has been submitted to Apple and will hopefully be in the App Store later next week.

Sun Position Explorer

The app initially just displays a “daylight” map of the world, showing day and night time areas, as well as the location on the surface where the sun is directly overhead. The date can be animated to show the movement of the sun during the day, or from day to day, and can be used to illustrate various subjects including day and night as well as seasons, and also how polar regions have “midnight sun” in the summer.

I intend to create future versions which display other data and graphs related to the position of the sun, including the sun’s path across the sky from any given location, for any given time and date.

JSON data list for www.bom.gov.au

I needed weather observation data from the Australian Bureau of Meteorology for an App I’m currently working on.
Although the BOM provides observation data for all stations in JSON format, they don’t provide a list of JSON pages etc. So I’ve had to compile a list including Station name, and location. Read the rest of this entry »

Dashed Line Sprite for Cocos2d-html5

I noticed a request on the cocos2d-html5 forum for a “dashed line” drawing class, so I wrote this class based on code posted to stackoverflow.

dashed_line_sprite

Read the rest of this entry »

Traffic Control game source now on GitHub

I’ve now uploaded the source code for my first cocos2d-HTML5 game “Traffic Control” to GitHub.

https://github.com/synergie7/cocos2d-HTML5-traffic-control

 

As cocos2d-HTML5 is changing all the time, I’ve included cocos2d-HTML5 as a sub project so that the correct version can be downloaded with the game code.

Traffic Control game in Cocos2D-HTML5

Cocos2D-HTML5

Over the last week I’ve been evaluating Cocos2D-HTML5 as a general HTML5 development framework and I find the best way to do an evaluation is to attempt to actually build something.

So here is my first Cocos2D-HTML5 game. Click Here to play the game .

traffic_control_screengrab