Sketch Uploading Questions

I am going to make a USB->ICSP bridge using the FT232RL's bit bang mode instead of having to get a full-fledged AVR programmer. My idea was that after configuring the FT232's eeprom for bit-bang mode, I could write a python script which would take the hex file given by arduino's verbose output and translate into the ICSP commands for the AVR. I've looked @ the ArduinoISP sketch, so I know what the arduino board does with the data it receives, and what it sends back to the computer (errors, etc.). My question is what file, exactly, is being sent to the arduino board? I assume it would be this hex file (for blink example):

:100000000C9461000C947E000C947E000C947E0095
:100010000C947E000C947E000C947E000C947E0068
:100020000C947E000C947E000C947E000C947E0058
:100030000C947E000C947E000C947E000C947E0048
:100040000C949A000C947E000C947E000C947E001C
:100050000C947E000C947E000C947E000C947E0028
:100060000C947E000C947E00000000002400270009
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C000000011241FBECFEFD8E0DEBFCDBF11E08E
:1000D000A0E0B1E0EAEFF3E002C005900D92A0309D
:1000E000B107D9F711E0A0E0B1E001C01D92A9303D
:1000F000B107E1F70E94F4010C94FB010C9400009D
:100100008DE061E00E949C0168EE73E080E090E089
:100110000E94E2008DE060E00E949C0168EE73E0C6
:1001200080E090E00E94E20008958DE061E00E948E
:10013000760108951F920F920FB60F9211242F93FC
:100140003F938F939F93AF93BF93809104019091BE
:100150000501A0910601B0910701309108010196B7
:10016000A11DB11D232F2D5F2D3720F02D57019696
:10017000A11DB11D209308018093040190930501F6
:10018000A0930601B09307018091000190910101B5
:10019000A0910201B09103010196A11DB11D8093B0
:1001A000000190930101A0930201B0930301BF915C
:1001B000AF919F918F913F912F910F900FBE0F9014
:1001C0001F9018959B01AC017FB7F89480910001B6
:1001D00090910101A0910201B091030166B5A89B25
:1001E00005C06F3F19F00196A11DB11D7FBFBA2F49
:1001F000A92F982F8827860F911DA11DB11D62E0A0
:10020000880F991FAA1FBB1F6A95D1F7BC012DC08B
:10021000FFB7F8948091000190910101A091020133
:10022000B0910301E6B5A89B05C0EF3F19F0019618
:10023000A11DB11DFFBFBA2FA92F982F88278E0FA0
:10024000911DA11DB11DE2E0880F991FAA1FBB1FC0
:10025000EA95D1F7861B970B885E9340C8F2215030
:1002600030404040504068517C4F211531054105D8
:10027000510571F60895789484B5826084BD84B583
:10028000816084BD85B5826085BD85B5816085BD91
:10029000EEE6F0E0808181608083E1E8F0E01082AA
:1002A000808182608083808181608083E0E8F0E0EB
:1002B000808181608083E1EBF0E0808184608083D5
:1002C000E0EBF0E0808181608083EAE7F0E080810C
:1002D000846080838081826080838081816080836C
:1002E0008081806880831092C1000895482F50E07B
:1002F000CA0186569F4FFC0124914A575F4FFA016D
:1003000084918823C1F0E82FF0E0EE0FFF1FE85939
:10031000FF4FA591B491662341F49FB7F8948C9157
:10032000209582238C939FBF08959FB7F8948C915A
:10033000822B8C939FBF0895482F50E0CA018255AD
:100340009F4FFC012491CA0186569F4FFC013491B6
:100350004A575F4FFA019491992309F444C022232C
:1003600051F1233071F0243028F42130A1F02230F3
:1003700011F514C02630B1F02730C1F02430D9F483
:1003800004C0809180008F7703C0809180008F7DB2
:100390008093800010C084B58F7702C084B58F7DB4
:1003A00084BD09C08091B0008F7703C08091B000F8
:1003B0008F7D8093B000E92FF0E0EE0FFF1FEE5825
:1003C000FF4FA591B491662341F49FB7F8948C91A7
:1003D000309583238C939FBF08959FB7F8948C9199
:1003E000832B8C939FBF08950E943B010E94950030
:0A03F0000E948000FDCFF894FFCFBB
:00000001FF

Is this right? Also, Are the colons sent along also? Or are they removed?

Thanks a lot!

baum

The file you're looking at is an "Intel Hex format" representation of binary code. In addition to the code itself, it contains info about the location and size of each record, plus error checking, plus it's transformed to make it sort-of human readable and manipulable using standard text editors.

The data sent (by avrdude) to either the bootload, or to ISP programmers, or by the FTDI bitbang hack is all pure binary; whichever application reads the hex file and converts it before sending it. You can look at optiLoader, which includes a simple hex-file to binary parser (warning, it assumes that the binary is "small.")

You know that the FTDI bitbang ISP programmer has already been done, right? http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html#top

Only thing I'm confused about with what you talked about is how the arduino software knows what to send over USB. The FTDI chip can't do any processing; it only outputs exactly what it receives over USB. And I'm not interested in bootloaders (I want this to work for ATtinys, particularly): I wanted to make simpler USBtinyISP using hardware instead of software, with a python script (not arduino) doing the uploading.

baum

For an FTDI bit-bang programmer, what actually gets sent over the USB connection is FTDI-specific commands like "set the SPI-CLK pin to 0. Set the SPI-DATA pin to 1/0. Set the SPI-CLK pin to 0 ...", once for each bit in each byte of the decoded binary sketch, plus more bits for the SPI commands that the AVR uses for SPI programming, plus who knows what else, all sent essentially one bit at a time. All of this packaged inside of relatively complex USB "packets" that the FTDI hardware and other firmware uses to figure out that that particular packet is for that particular FTDI chip and no some other USB device on the same bus. So there are sketch data bits, inside of AVRISP programming commands, inside an FTDI bitbang command, inside of USB packets.

It's not a very efficient way to use the computer or the USB bus. But who cares?

Would there be any other more efficient way to create a usb-icsp converter? The reason I ask is that I am making a dev board for the ATtiny85 and wanted to have some way of easily using USB to upload sketches, instead of requiring the user to already have an AVRISP.

baum

Well, you can use an Arduino running ArduinoISP as a programmer. Or a modified version thereof. You could have your board plug into the top digital IO connector of an Arduino (AREF-D10 or so) and be programmed via that (of course, and arduino is somewhat more expensive than a clone AVRISP programmer. But so is an FTDI breakout.)

No... I mean have something ON the board, like the FTDI chip on the arduino. Then the user just needs to plug the usb cord into the board.

Just remembered V-USB. Is that any good/easy-ish to use? I could load that onto a tiny84 (14PDIP)...

baum