Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Support => AVRDude => Topic started by: jcr on July 17, 2012, 04:35:34 pm

Title: Programming an Attiny45 clocked at 32.768kHz
Post by: jcr on July 17, 2012, 04:35:34 pm
Does anyone know of a way to slow down a Bus Pirate's programming speed to or below 4kHz, so that it'll allow me to program an Attiny45 clocked with an external 32.768kHz crystal? Preferably one that doesn't involve a massive amount of coding in either avrdude or the Bus Pirate's firmware ;)

The slowest possible SPI speed of 30kHz is way too fast for this configuration and results in the dreaded "initialization failed, rc=-2" error, but luckily with a known cause this time. I've also tried an avrdude patch I ran across that implements avr programming through the raw wire protocol (avrdude patch #7723), but this bottoms out at 5kHz and still results in failures. Since I've only got a BPv4, the stk500 firmware also doesn't seem to be an option.

Right now I have to make do with a bsd parport programmer as a workaround (with -B 250 -i 1000), but this is a big hindrance in my development process (requires unplugging, walking to a different room, etc). I'd rather use my favorite little tool.
Title: Re: Programming an Attiny45 clocked at 32.768kHz
Post by: jcr on July 23, 2012, 02:31:41 pm
Ok, scratch that question. I worked around the problem by purchasing a "real" avr programmer, because it was one of those "needs to be done by yesterday" projects. But with this out of the way, I'd still like to have a BP capable of programming at variable speeds instead of set SPI rates. Which sounds like a perfectly good excuse to attempt adding an stk500 mode to the BPv4, which I'll try next ;)
Title: Re: Programming an Attiny45 clocked at 32.768kHz
Post by: ian on July 25, 2012, 06:25:51 pm
I think the AVRDude mode uses hardware SPI and the low speed is limitation of the hardware. It could go slower with a [patch to support software SPI too, but It wouldn't be totally easy because hardware SPI mode had extended support for the programming app.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00982056480session_write_close ( )...(null):0
20.01022188072ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01022188848Database_MySQL->query( ).../DatabaseHandler.php:119
40.05462327584Database_MySQL->error( ).../Db-mysql.class.php:273