Monday, May 12, 2014

TinySafeBoot on attiny84

The TinySafeBoot, this is a small bootloader that will take up 550 bytes so you are left with around 7450 bytes of sketch left. Let me explain a bit of details and instructions as the TinySafeBoot site were not catering to Arduino users in terms of step by steps instructions for beginners.

The reason to install this TinySafeBoot is pretty obvious, you can directly program the attiny84 similar like Arduino UNO using on Serial Tx/Rx pins instead of using the UsbTinyISP. I am connecting a FTDI USB Serial module for both programming and debugging functions using <TinyDebugSerial.h>.


Attiny84 with FTDI

The above image is my prototype attiny84 with FTDI module Serial Debug / Monitor to pin PB0(tx) and PB1(rx).

The steps are as follows :-

1. Download TinySafeBoot from http://jtxp.org/tech/tinysafeboot_en.htm

2. Generate the bootloader hex for attiny84 :-

tsb tn84 b1b0  ( b1 = pin PB1/rx b0 = pin PB0/tx )

3. Burn the above generated hex bootloader to the attiny84

avrdude -c usbtiny -p t84 -U flash:w:<tsb_tn84_b1b0_20140414.hex>

4. Set the fuse bits on attiny :

avrdude -c usbtiny -p t84 -U efuse:w:0xFE:m ( Turn on SELFPRGEN bits )

5. To get the status of the bootloader, RESET the attiny84, wait for 2-3 secs and execute the commands :-

tsb COM5 i  ( get current status from the bootloader )

or

6. To burn a hex to the attiny84, RESET the attiny84, wait for 2-3 secs and execute the commands :-

tsb COM5 fw blink84.hex

( You can compile the hex under Arduino UNO by choosing the board attiny84 @ 8Mhz and copy the hex files to the tsb folder. To see where the hex is compiled and located, Under Arduino IDE Preferences, Click on "Show verbose output during [x] compilation" )

Final product on Tiny nRF V1.0

Tiny nRF V1.0


Summary Links :-

- TinySafeBoot
- Attiny84 Fuse calculator http://eleccelerator.com/fusecalc/fusecalc.php?chip=attiny84
- Arduino Tiny codes https://code.google.com/p/arduino-tiny/
- Arduino Forum on attiny84/85 http://forum.arduino.cc/index.php?topic=115822.msg1698859#msg1698859