Buy Magic Mushrooms
Magic Mushroom Gummies Best Amanita Muscaria Gummies
Nov 122011
 

ATTiny10 programming

Using Darrel Tan’s Programming the ATTiny10 instructions and a SOT-23 breakout board by Raphael, I was able to flash one of these very small MCU chips. Given the small package, these programmable devices can be dropped just about anywhere on a circuit that a transistor would be used.

Unlike Tan, my FTDI breakout cable does not have DTR, so the reset pin on the chip needs to be pulled low manually to put it into programming mode, and the pinout adjusted. Full instructions after the break…

TXD (Orange) --///--+
                      |   +----------------------+
CTS (Brown)  ---------+---| TPI DATA (1)   RESET | ------+
GND (Black)  -------------| GND              VCC | ---+  |
RTS (Green)  -------------| TPI CLK           NC |    |  |
                          +----------------------+    |  |
                                                      |  |
VCC (Red)    -----------------------------------------+  |
                                                        |
GND (Black)  ---------   -------------------------------+

In /usr/local/etc/avrdude.conf add:

programmer
  id    = "dasaftdi";
  desc  = "tiny10 no reset, sck=!rts mosi=!txd miso=!cts";
  type  = serbb;
  reset = ~4;
  sck   = ~7;
  mosi  = ~3;
  miso  = ~8;
;

Test program to generate a square wave output on pin D2. My version of avr-gcc doesn’t support the ATTiny10, so I’ve hardcoded the register assignments and pass in the wrong device name to the compiler.

#define DDRB2 2
#define DDRB 0x01
#define PORTB 0x02

.global main
main:
        ldi r16, (1 << DDRB2)
        out DDRB, r16

loop:
        ldi r16, (0 << 2)
        out PORTB, r16
        nop
        ldi r16, (1 << 2)
        out PORTB, r16
        rjmp loop

Compile and generate an Intel hex file:

avr-gcc -mmcu=attiny11 test.S -o test.elf
avr-objcopy -O ihex test.elf test.hex

Manually pull the reset line to ground and flash with this command (substitute the correct path to your FTDI device:

avrdude 
  -p attiny10 
  -c dasaftdi 
  -P /dev/tty.usbserial-FTE531WL 
  -U flash:w:test.hex 

If all goes well, release the reset line and put a scope on pin 4. You should see something like this:
Square wave from an ATTiny10

 Posted by at 11:54 pm

  3 Responses to “ATTiny10 programming”

Comments (2) Pingbacks (1)
  1. […] reading after the first duplicate read succeeds. There are enough pins on the Tiny85 (or even the microscopic Tiny10) and plenty of space left if I wanted to add a switch to select between different IDs, but this […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)