Close

Notes on Programming the Attiny10

A project log for Attiny10 Chiptunes

Chiptunes and simple musical games on a 36 cent chip. Some assembly required.

legionlabsLegionlabs 03/20/2023 at 03:520 Comments

I'll detail some tips on programming the Attiny10 here.

TPI Programming

First, the attiny10 uses TPI programming, not ISP. You can build a TPI programmer using an Arduino (https://github.com/james-tate/Arduino-TPI-Programmer), or buy an AVR-ICE.

As an IDE, you've got microchip studio, which is a bit bloated and Windows-only. To be fair though, it is also very feature-rich and the AVR simulator seems reasonably accurate. The latter item is an improvement over AVR Studio 4, which I used to use.

There is also the more minimalist Attiny10IDE (https://github.com/wholder/ATTiny10IDE) which is cross platform. Either of these can produce hex files that you will paste into the serial monitor, if using an Arduino as a programmer. If using the AVR-ICE, you'll likely be programming the chip from Microchip Studio.

Dealing with SOT-23-6

Next up, the chip is SOT-23-6. Sockets for that are sort of expensive. So I bought 2 breakout boards that convert it to DIP-6. The first, I solder a chip to -- this one goes into a little board with header pins exposed that I can use to hook up to my scope and test code performance. The other, I leave unpopulated. It goes into a programming board (via a DIP-8 socket) that connects the correct pins from the AVR-ICE or Arduino to the attiny10. To program a chip, I just sort of drop it on the pads and press it down with my finger -- this works just fine. However, you must observe polarity or you'll lose the chip and burn yourself!

Bugs on the AVR-ICE

Note that there's a bug on the AVR-ICE circuit board. The SWD header is soldered in upside down. So the red mark on the ribbon cable is pin 10, not pin 1. This is correctly indicated on the solder mask. If using the full AVR-ICE kit this is not problem -- they use a weird little adapter board to silently flip the cable a second time. However if you're like me and the idea of paying such a high price for a plastic case and cable is physically painful to consider, they will sell you the AVR-ICE circuit board alone for a reasonable price! You can then connect your own SWD cable, as long as you remember to reverse pin order. Also note that the AVR-ICE will not power the chip being programmed. You'll need to do that as well.

If the engineer who swapped the header reads this one day -- thanks for correctly labeling the solder mask. Otherwise I'm not sure how I would have worked this out.

Discussions