ATTINY Arduino Toolchain
The basics on this one are very similar to the SAM arduino guide. This time, though, no bootloaders! Wonderful, we get right into it.
This guide is for the ATTINY412
and ATTINY1416
specifically, which are available in the fab lab inventory, but extends to a wide array of parts in the ATTINY family, as documented here.
1: UPDI Connection
The UPDI connection is made by connecting both ends (tx and rx) of a usb to serial converter to the UPDI pin on the target microcontroller: the RX line connects directly, and the TX line connects to that with a ~ 5k ohm resistor. For more detail, check this out. FTDI connectors carry a semi-standard pinout, which is shown below, converting to a three pin UPID header:
board files here, ctrl + f for ‘UPDI’
The connection can then be made to the microcontroller, examples for the ATTINY412 and ATTINY1614 are included below.
ATTINY412 Example
board is here, from Neil, ctrl + f for ‘attiny412’ (t412-blink-3 pin)
ATTINY1614 Example
board is here, from Neil, ctrl + f for ‘attiny412’ (t1614-echo)
With this schematic, we use a 2-pin UPDI connector, meaning we also need to provide it with power when it’s being programmed!
2: Arduino Setup
These boards aren’t supported by arduino out of the box. In order to make that happen, we need to open up arduino and do:
file -> preferences -> additional board manager URLS
- add this link:
http://drazzy.com/package_drazzy.com_index.json
- add this link:
- now arduino will be able to find the “board definitions” when we do:
tools -> board -> board manager
- search for
megaTinyCore
- hit
install
- search for
The tiny board should show up in your board manager options. To program a board, attach your serial programmer to ground, UPDI, and to power if needed, and change the following settings:
- choose correct board
- choose programmer as
Serial-UPDI
withSlow 57600 baud
You should now be able to program from the Arduino IDE.
3: Pin Mappings
For more explainer on pin mappings, read this: the arduino “pin numbers” don’t always correlate directly to the ATTINY pin numbers (either physically, on the package, or port-wise, in the ATTINY core software).