Skip to content

Instantly share code, notes, and snippets.

@astrolemonade
Forked from amcolash/ATTiny + Micronucleus
Created March 11, 2024 00:19
Show Gist options
  • Save astrolemonade/099a221cb6610f1cbfa07f3803c90fea to your computer and use it in GitHub Desktop.
Save astrolemonade/099a221cb6610f1cbfa07f3803c90fea 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment