Skip to content

Instantly share code, notes, and snippets.

@CTXz
Last active April 1, 2020 22:34
Show Gist options
  • Save CTXz/cc154f30b2961b86a41b7e738ac4e203 to your computer and use it in GitHub Desktop.
Save CTXz/cc154f30b2961b86a41b7e738ac4e203 to your computer and use it in GitHub Desktop.

Programming ATtiny chips with an Arduino

1. Flash the ArduinoISP firmware onto the programmer board (ex. Arduino UNO) 2. Connect the Arduino's SPI header to the ATtiny:

Arduino ATiny Digispark
5V VCC Vin
GND GND GND
MOSI PB0 P0
MISO PB1 P1
SCK PB2 P2
RST or D10 PB5 P5

3. In your Platformio Project, add the following to your platformio.ini:

[env:attinyXX]
platform = atmelavr
board = attinyXX
framework = arduino

upload_protocol = stk500v1
upload_flags =
    -P$UPLOAD_PORT
    -b19200


; edit this line with the valid upload port
upload_port = /dev/ttyACM0

where XX must be replaced with the number of model number of your ATttiny chip (ex. 85).

If desired, the fuse bits may also be set in the upload_flags declarative.

4. With the Arduino connected via USB, upload the project and wait for the flashing process to complete

Troubleshooting

1. Wrong device signature:

There are numerous reasons why a wrong device signature is detected. First, ensure the compile target is set to the correct chip. If the signature is always 0x000000, then the device is either not powered or grounded, or the wiring for the MISO and MOSI pins are off. If the signature is rather random and changes on every attempt, ensure the reset pin is properly connected. On many Arduino's, the slave select pin cannot be used and the D10 pin has been assigned as the reset pin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment