Today we’re refining the new AVR programmer firmware for the Bus Pirate. The plan is to implement an optional high-impedance output mode that can be used with pull-up resistors to program AVRs at 5volts (or any voltage).

You can follow our progress and get involved on an experimental chat page. Live prototyping was inspired by adafruit’s “Ask an engineer chat“, be sure to check out their weekly live stream.

Live prototyping is now over, thanks to everyone who dropped by. You can download the resulting firmware update here. A transcript of the firmware development portion is after the break.

05:11:15 ‹ian› First:

22/11/2009 05:11:55 ‹ian› Decide if there’s a way to make the high-impedance bus + (optional) onboard pullup resistors part of the same STK500 firmware.
22/11/2009 05:12:14 ‹ian› The other option is to have two separate firmwares.
22/11/2009 05:13:16 ‹ian› My first thought was to measure a voltage on the Vpullup pin, if it’s >0, then use high-impedance mode with pullups.
22/11/2009 05:14:04 ‹ian› THe primary problem with that is – what if you want HI-Z but no on-board pull-ups? What about hardware v0a? Most importantly, how do you tell the user they have one mode or the other?
22/11/2009 05:15:49 ‹ian› I think for the moment I’ll work on two separate firmwares using defines to compile the different versions.
22/11/2009 05:17:04 ‹ian› Begin code is…TK500v2 (r128 and earlier).
22/11/2009 05:17:52 ‹ian› Changes need to be made primarily to the SPI.h file.
22/11/2009 05:18:13 ‹ian› Starting with different configurations of the ODC (open drain/collector) pin configuration bits:
22/11/2009 05:18:14 ‹ian›…i.c#117
22/11/2009 05:21:09 ‹ian› The author of the STK500v2 code releases updates, so my strategy has been to do as few modifications to his primary source (located in main.c) so it’s easy to do a diff with a utility like Winmerge and see what needs to be changed when new code is released.
22/11/2009 05:23:00 ‹ian› So… I put the Bus Pirate communication and configuration routines in separate files. We’ll also need to enable the pull-up resistors in the initialization routine, instead of disabling them:…se.c#16 (for v2 & v3 only)
22/11/2009 05:23:16 ‹ian› Now I need to rummage for some parts. Be right back.
22/11/2009 06:04:41 ‹ian› Sorry about that, thought I had a 6pin ISP to 10pin ISP adapter, but I had to solder one.
22/11/2009 06:05:59 ‹ian› The first thing I’m going to do is add some defines to base.h so we can create custom firmwares at compile time:
22/11/2009 06:06:01 ‹ian›…/base.h
22/11/2009 06:18:44 ‹ian› //these compile time options enable various features #define ENABLE_VREG
22/11/2009 06:19:12 ‹ian› Ok, added compile options for the hi-z outputs, and the pull-up resistors
22/11/2009 06:19:24 ‹ian› also added toggle for the voltage regulators
22/11/2009 06:20:05 ‹ian› uploaded to SVN as rev130:…/base.h
22/11/2009 06:20:26 ‹ian› Now I’ll use these defines to determine behavior elsewhere in the code.
22/11/2009 06:30:59 ‹ian›…se.c#16
22/11/2009 06:31:07 ‹ian› new defines control setup with vreg enabled and pullups enabled.
22/11/2009 06:33:25 ‹ian› Finally, I’m going to add the switch for open drain pin control to spi.c
22/11/2009 06:33:42 ‹ian›…2/spi.c
22/11/2009 06:34:01 ‹ian› This is the code of interest:…i.c#126
22/11/2009 06:42:20 ‹ian› done, new code submitted.
22/11/2009 06:43:53 ‹ian› The alternative firmware is currently shoved in the nightly firmware folder, I’ll make a new folder for it and document the files.
22/11/2009 07:08:30 ‹ian› Compiled and committed the new released to the SVN nightly folder
22/11/2009 07:09:58 ‹ian›…nightly
22/11/2009 07:14:29 ‹ian› Also uploaded as an archive…