Go Down

Topic: Pimp my USBASP (Read 185 times) previous topic - next topic

casemod

May 26, 2016, 09:18 pm Last Edit: May 26, 2016, 09:38 pm by casemod Reason: Attachment of Hex file for programming
One of the things that always upset me was how slow arduino compilation & upload is using an USBASP. I'm not entirellly sure what's the cause: AVR Studio can upload and check a 30K Hex in about 2 seconds, so what causes arduino to take nearly 5 times as much to accomplish the same task (excluding the ridiculous long compilation times on windows platforms) is still a mystery.

I recently observed that the USPASP is capable of clock speeds up to 1.5MHz, so I wasn't quite sure what was causing the device to be MUCH slower than an equivalent AVR ISP at 2Mhz. In fact, the USBASP is slower than the standard serial upload.

Upon examination I realized that the parameter to set the clock speed doesn't appear to be sent by the arduino, nor did I found a way to send it, as such the device operates at the default speed of 375Khz and a low speed of about 8Khz.

8Khz is good enough to recover a ATMEGA running from a 32Khz RTC Oscillator. I dont think many of us are using such a low clock, so for 98% of the cases a 1Mhz (Factory default) and above are all that is needed.

With that I did two things:

  • Downloaded USBASP firmware to here USBaspTTY - This adds Serial support with a terminal application.
  • Recompiled the firmware to allow for operation at 93.75Khz (Low) and 1.5Mhz (High). The Low setting can be used for new AVR's clocked at 1Mhz and the high setting for AVR's with a clock speed > 8Mhz.
  • Compiled the binaries and generated a new Hex File to be uploaded to the device (ATMEGA8)



To program the USBASP a programmer is needed. I used a second USBASP, connected as below, but any other ISP AVR programmer can be used. Jumper JP2 on the device being programmed has to be shorted.




JP2 has to be shorted: This Jumper is often not installed. JP3 is used to select the clock speed (Low/High)



JP3 function may vary. On mine it sets output voltage to 3.3/5V or none.


For comparison, 20K sketch loading times

Before the upgrade
------------------------

Sketch Loading Times
  • 178 Seconds (Low Speed, 8Khz)
  • 13 Seconds (High Speed, 375Khz)


After the upgrade
------------------------

  • 22 Seconds (Low Speed, 93.75KHz)
  • 7 Seconds (High Speed, 1.5MHz) (Same time as UNO Serial Bootloader)


So bye bye to the slow programming times using an USBASP. I would still recommend to have at least one unmodified USBASP as I haven't tried with all uP (Attinys and the like).

The fact the USBASP now has serial capabilities also means green light for standalone ATMEGA processors. The bootloader is not required and the serial communication remains active, accessed trough the terminal application on the link above (No more messing with comm ports yay :-))

Note that not all the USB asp versions have the Serial pins routed. On mine (The small blue board) Serial is on pins 4(RX) & 6(TX) of the 10 pins ISP connector. This may vary, so getting one as per picture above would probably be advantageous.


pert

You'd probably be interested in the work that's being done on the USBasp firmware by some Arduino forum members: http://forum.arduino.cc/index.php?topic=363772.msg2762234#msg2762234. Some huge improvements have been made, including automatic clock speed selection. It's available at https://github.com/PeterVH/usbasp.

casemod

#2
May 27, 2016, 01:21 am Last Edit: May 27, 2016, 02:36 am by casemod
You'd probably be interested in the work that's being done on the USBasp firmware by some Arduino forum members: http://forum.arduino.cc/index.php?topic=363772.msg2762234#msg2762234. Some huge improvements have been made, including automatic clock speed selection. It's available at https://github.com/PeterVH/usbasp.
Thanks for the link, good read!

For now I rather leave it as it is, this was just meant as a simple 'upgrade' to the original firmware, but I might try it at some point, or combine to get the RS-232 functionality too (think they forgot that, which is very useful for me).

Its good to see they fixed the patchy low clock speeds with the delays included to slow down the main SPI clock, that was one of the hidden reasons I chose the 92Khz minimum as it is the lowest 'hardware' mode (I got timeout issues often using the lower 'software' settings).

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy