Skip to content

Instantly share code, notes, and snippets.

@amcolash
Last active April 23, 2024 21:28
Show Gist options
  • Save amcolash/b930cb9d206b75ca5fd4ab974cb78a60 to your computer and use it in GitHub Desktop.
Save amcolash/b930cb9d206b75ca5fd4ab974cb78a60 to your computer and use it in GitHub Desktop.
ATTiny85 + micronucleus using an AVR programmer
This gist is a list of instructions that I used to program my ATTiny85s with Micronucleus. They worked for me, but your mileage may vary! I would highly recommend starting by looking at the SparkFun article linked at the bottom for schematics and more in-depth info. This gist is mostly just a copy/paste list.
## Required:
- ATTiny85
- AVR programmer
- 1 uF capacitor
- Micronucleus FW: https://github.com/micronucleus/micronucleus/releases
- avrdude: http://www.nongnu.org/avrdude/
## Setup:
- Attach the avr programmer to the tiny
- Attach cap from GND to RESET (Otherwise try GND <-> V+. I only needed this the 2nd time)
- Plug in AVR programmer
- Download FW and unzip
- Make sure you have avrdude
## Burning:
- `cd micronucleus-master/firmware/releases`
- Burn firmware: `avrdude -P usb -c usbasp -p t85 -U flash:w:t85_default.hex`
- Burn fuses: `avrdude -P usb -c usbasp -p t85 -U lfuse:w:0xe2:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m`
- NOTE: user @german-namestnikov found that the above did not work and instead changed the value of the `CKSEL` bit. Instead they used `avrdude -P usb -c usbasp -p t85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m`
- Verify fuses (should read E:FE, H:DD, L:E2): `avrdude -P usb -c usbasp -p t85 -U lfuse:r:-:i`
- Test it works by unplugging from avr, use usb connection
- Go to commandline tool folder: `cd ../../commandline`
- Build + test: `make && micronucleus -?`
## Using with Arduino:
- Add additional board: http://digistump.com/package_digistump_index.json
- Install "Digistump AVR Boards"
- Select board "Digispark Default" and programmer "Micronucleus"
If things don't work it is most likely that the arduino board package does not have the latest micronucleus tool.
To fix, run `cp micronucleus-master/commandline/micronucleus ~/.arduino15/packages/digistump/tools/micronucleus/2.0a4`
Restart Arduino
Cheers!
## Sources:
- https://learn.sparkfun.com/tutorials/how-to-install-an-attiny-bootloader-with-virtual-usb/install-micronucleus
- http://digistump.com/wiki/digispark/tutorials/connecting#software
@f-zhuk
Copy link

f-zhuk commented Apr 23, 2024

Oh god just thank you

my board cost me 2 bucks and no hassle to get a new one locally, I am just frustrated with tons of useless guides and youtube videos I watched before I got here.
Worked nicely for digispark board, no additional cap used

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