rsbohn/ArduinoISP — pull request #2 by sylvandb (2012-01-27 09:07:05+00:00)
Title: fix/workaround for SPI too fast

I needed to program a slow clocked ATtiny2313.

Couldn't do it. Errors at various places -- reading signature, reading fuses, sync errors, etc. SPI clock was just too fast for my slow t2313.

I added USE_SPI macro wrapping the built-in SPI support, and added some #else cases with bitbanged SPI support and SUCCESS! Programed my t2313. (critical)

I also did some cleanup of the initialization of the SPI pins. This way the level is set before they become outputs instead of possibly driving one direction then immediately being changed. (possibly important)

And I played a bit with baud rate, SPI config, etc. as you can see. (might be nice to have the #defines)

Thoughts?

(I was using AVRDude 5.10, ubuntu 11.04, arduino 022 with latest arduinoISP sketch, 16mhz ATmega328.)