Tuesday, 8 January 2019

arduino - Burn Micronucleus bootloader to use ATtiny85 via USB (AVRDUDE)



I am working on an ATtiny85 USB development board, and I need to flash the Micronucleus bootloader on it. I have heard that this bootloader allows the ATtiny85 to be programmed via USB from the computer, without the need of an external programmer.


So I decided to try to burn it, using the Arduino Uno as ISP. I downloaded the bootloader, AVRDUDE, opened the command prompt (I'm using Windows 8.1), navigated to the .hex file folder and wrote this:


avrdude -c arduino -b 19200 -P COM6 -p t85 -U flash:w:micronucleus-1.06.hex -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m

Does that sounds right? That's what the prompt outputs:


C:\Users\Mohamed\Desktop\micronucleus-master\firmware\releases>avrdude -c arduin
o -b 19200 -P COM6 -p t85 -U flash:w:micronucleus-1.06.hex -U lfuse:w:0xe1:m -U
hfuse:w:0xdd:m -U efuse:w:0xfe:m

avrdude: please define PAGEL and BS2 signals in the configuration file for part

ATtiny85
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930b
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: please define PAGEL and BS2 signals in the configuration file for part
ATtiny85
avrdude: reading input file "micronucleus-1.06.hex"
avrdude: input file micronucleus-1.06.hex auto detected as Intel Hex
avrdude: writing flash (8162 bytes):

Writing | ################################################## | 100% 3.91s

avrdude: 8162 bytes of flash written
avrdude: verifying flash memory against micronucleus-1.06.hex:

avrdude: load data flash data from input file micronucleus-1.06.hex:
avrdude: input file micronucleus-1.06.hex auto detected as Intel Hex
avrdude: input file micronucleus-1.06.hex contains 8162 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 9.37s

avrdude: verifying ...
avrdude: 8162 bytes of flash verified
avrdude: reading input file "0xe1"

avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe1:
avrdude: load data lfuse data from input file 0xe1:
avrdude: input file 0xe1 contains 1 bytes
avrdude: reading on-chip lfuse data:


Reading | ################################################## | 100% 0.03s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xdd"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of hfuse written

avrdude: verifying hfuse memory against 0xdd:
avrdude: load data hfuse data from input file 0xdd:
avrdude: input file 0xdd contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xfe"

avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfe:
avrdude: load data efuse data from input file 0xfe:
avrdude: input file 0xfe contains 1 bytes
avrdude: reading on-chip efuse data:


Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

Is it flashed now? Because when I plug it in the USB port I get this error message: "USB device not recognized". Do I have to install some driver, or flash anything else on the ATTiny85?




Answer



You probably found a solution by now, but for others: in order to use an ATTiny85 with micronucleus via USB, you need a micronucleus driver installed, then you can use Arduino IDE if you want - simply add the "Additional Board Manager URL" http://digistump.com/package_digistump_index.json under Arduino IDE 1.6.5(or greater)'s Preferences and choose "Digistump AVR boards" under the Tools... Board... Board Manager...


Note: you will upload sketches slightly differently with micronucleus. You must insert / reinsert the ATTiny85's USB plug after the sketch has compiled and is ready to upload.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...