Last active
April 23, 2024 21:28
-
-
Save amcolash/b930cb9d206b75ca5fd4ab974cb78a60 to your computer and use it in GitHub Desktop.
ATTiny85 + micronucleus using an AVR programmer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Hi, thanks for this help. I have a weird issue, after upload process the board doesn't works. It's dont recognized like other boards like digispark for example.
I think that I have a right output:
(master) avp:releasesȹ avrdude -P /dev/ttyUSB0 -c buspirate -p t85 -U flash:w:t85_default.hex
Attempting to initiate BusPirate binary mode...
avrdude: Paged flash write enabled.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.09s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "t85_default.hex"
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: writing flash (8170 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 8170 bytes of flash written
avrdude: verifying flash memory against t85_default.hex:
avrdude: load data flash data from input file t85_default.hex:
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: input file t85_default.hex contains 8170 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 8170 bytes of flash verified
avrdude: safemode: Fuses OK (E:FE, H:DD, L:E2)
avrdude done. Thank you.
But when I disconnect the board from my Bus Pirate and put it for upload my firmware, is not recognized.
I have the next dmesg error:
Sep 4 14:31:34 minisf kernel: [63716.543286] usb 1-2.1.4-port1: attempt power cycle
Sep 4 14:31:34 minisf kernel: [63717.253148] usb 1-2.1.4.1: new low-speed USB device number 25 using xhci_hcd
Sep 4 14:31:34 minisf kernel: [63717.280869] usb 1-2.1.4.1: Device not responding to setup address.
Sep 4 14:31:35 minisf kernel: [63717.520815] usb 1-2.1.4.1: Device not responding to setup address.
Sep 4 14:31:35 minisf kernel: [63717.733167] usb 1-2.1.4.1: device not accepting address 25, error -71
Sep 4 14:31:35 minisf kernel: [63717.929175] usb 1-2.1.4.1: new low-speed USB device number 26 using xhci_hcd
Sep 4 14:31:35 minisf kernel: [63717.956806] usb 1-2.1.4.1: Device not responding to setup address.
Sep 4 14:31:35 minisf kernel: [63718.196790] usb 1-2.1.4.1: Device not responding to setup address.
Sep 4 14:31:35 minisf kernel: [63718.409224] usb 1-2.1.4.1: device not accepting address 26, error -71
It is my setup for upload it:
I found the issue, we need put extra options to burning step:
avrdude -P /dev/ttyUSB0 -c buspirate -p attiny85 -U flash:w:t85_default.hex -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m
I don't why, but with this line, with fuse burning in the same instruction, it works 👯
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
Thanks!