Skip to content
PeterVH edited this page May 11, 2016 · 19 revisions

Test suite for usbasp

A test suite has been defined to test our usbasp firmware. The usbasp firmware does not require a particular version of avrdude (v6.0.1 is what comes with the Arduino IDE at the time of this writing and that works ok). Nevertheless, following tests were carried out with avrdude 6.3.

Summary of software versions used:

  • avrdude 6.3.
  • linux 64bit, debian wheezy.
  • Arduino IDE 1.6.8
  • ATTinyCore by Spence Konde v1.1.0
  • MightyCore by MCUdude v1.0.4 (for the 1284p)
  • Source code for the test sketches is borrowed from these ArduinoISP tests.

Chaucer112K to 1284p@16MHz

Tests flashing a large sketch (it is now trimmed to 100KB) into a atmega 1284p. This is a duration and performance test. The name of the sketch is explained here: What do Geoffrey Chaucer and all these knights have to do with it?

Chaucer112K to Arduino Mega

Same test, different target.

LongStoryShort (program above 128KB)

Flashes a hex file that spans an area >128KB. This sketch dumps a very short version of the knight's tale on the serial port. This tale is much shorter than the one in Chaucer112K, keeping the sketch conveniently small. It still spans an area >128KB because the code sits at address 0x00000 while the tale is read from flash just above 128KB. Usbasp firmwares < v1.05 cannot program such hex files.

Capacitive load on MOSI

Usbasp fw versions prior to v1.06 had a faulty software spi implementation. It set mosi high or low according to the data bit that was being sent and immediately afterwards raised the clock signal. This does not give mosi sufficient time to rise and the target could sample an incorrect value. The faulty implementation works surprisingly well as long as the mosi signal is not loaded. Therefor we devised following test setup in wich the mosi signal is hindered by an rc filter:

usbasp                  target
           100
mosi _______R___________mosi
                   |               
                   C  100nF
                   |
                  /// gnd

The time constant of this rc circuit is 10 usec. So when using a clock of 16KHz (a pulse width of 31 usec) programming should work. It suffices to use JP3 to select 8KHz, or one could use -B, but none of this is needed: the clock probing selects 16KHz, which works ok.

This test was run with an attiny2313 clocked@8MHz! This is a (rare) case in which the needed spi clock speed is not related to the target clock speed.

Program an attiny2313 @ various speeds.

Program an attiny85@8KHz

Program an attiny841@8KHz

Test report:

The first column lists the result of the tests with usbasp v1.06.

All tests were carried out with automatic clock probing in action (no use of the -B option nor JP3 to select a slow clock). The second column lists the clock speeds chosen by the clock probing routine.

To give an idea of what has been improved and what already worked, the tests have also been carried out with the original firmware that came with two very popular devices on ebay. Their results are listed in the last two columns.

Test v1.06 v1.06 LC Technology Baite
                         | Result   | Probed Clock | Result | Result

No target connected | OK | - | OK | OK
Chaucer112K (100K) to 1284p@16MHz | OK (42.59s)| 1.5 MHz | OK (52.91s) | OK (69.03s) Chaucer112K (100K) to Mega | OK (42.86s)| 1.5 MHz | OK (53.25s) | OK (69.21s) LongStoryShort (program >128KB) | OK | 1.5 MHz | FAIL | FAIL Capacitive load on MOSI | OK (5.21s) | 16 KHz | FAIL | FAIL Program an attiny2313@12MHz | OK | 1.5 MHz | todo | todo Program an attiny2313@8MHz | OK (0.46s) | 1.5 MHz | OK (0.69s) | OK (0.53s) Program an attiny2313@1MHz | OK (0.73s) |93.75 KHz | OK (0.68s) | OK (0.58s) Program an attiny2313@128KHz | OK (5.21s) |16 KHz | FAIL | FAIL Program an attiny2313@32KHz | todo Program an attiny2313@16KHz | OK (28.7s) |1 KHz | FAIL | FAIL Program an attiny85 | todo Program an attiny841 | todo