How To Burn Micronucleus Bootloader On The Digispark Attiny85

0 views
Skip to first unread message

Giovanni Sealy

unread,
Aug 5, 2024, 10:17:23 AM8/5/24
to brokimdoca
Iam 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:


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" _digistump_index.json under Arduino IDE 1.6.5(or greater)'s Preferences and choose "Digistump AVR boards" under the Tools... Board... Board Manager...


Very strange thing that on first few runs Digispark had 2 red lights, which one of them blink(seems factory sketch). After some time and installs, digispark got only yellow lights. Now all time is yellow solid light. Is that reset at factory setting, boot mode or what? Think is power light.


So uploading the bootloader failed; usually this is because of either a cabling issue (wrong/bad connections) or a timing issue (programmer and target device communicate at slightly different speeds). The former is a matter of diligently checking your connections against the schematic. The latter can sometimes be solved by choosing a 'low speed' programmer option, which should/might be accessible from the Arduino IDE drop-down menu under 'Programmer'.


Ok, sorry about that; I don't know if and how an Arduino as ISP can be set to low speed. I use a dedicated USB-ASP programmer for this, which has a jumper that can set to force low speed. They're sold for a few bucks and handy keep around, but of course that doesn't help you right now.


That seems to indicate that you have choosen the Mega as the target; but pattiny85 in your command indicates that you have selected the attiny85 as the target so I'm a little confused.


U successfully done with "TOOLS->BURN BOOTLOADER" !

I made it because I change Preferences link for boards, from " _digistump_index.json"

to " -1.6.x-boards-manager/package_damellis_attiny_index.json" So, burner must be installed. But Digispark still not detect! I see only Port 1. Here is successfully data:


UPDATE:

I installed new bootloader, but only what I got is now not refreshing every 5 seconds. Still can't upload anithing.

Maybe all have do with USB 3.0 PORT ? I think that I have all USB 2.0 ports.


I've just received my digispark ATtiny85 (model B, I believe). I'm using Pop_OS for my PC, had a bit of a headache getting the arduino IDE recognising the device but after some trial and error I got there.


I couldn't work it out but found out that my boards came with v1.6 of the micronucleus firmware. So I upgraded to the latest which is v2.6. Now when I upload a sketch however the output looks like the following


I don't have a clue what to try next as everything feels like it should be at a working point. Not sure how to decipher "Updates may be available". I'm using the latest arduino IDE, with the digistump board manager url and using the latest micronucleus firmware for the board.


I tried to re-flash the firmware to v2.4 just on the off chance that the firmware was too new to be supported in arduino IDE but I received the same error as above but with just a different version number reported.


It seems the latest version (1.6.7) of the Digispark board support package is quite old, older than I'd have guessed. And so it does come with an old Micronucleus programming tool. The tool appears to compare the major version number of the firmware as found in the USB device version. And since the Micronucleus tool in the 1.6.7 package is expecting nothing newer than major version 1, major version 2 of the firmware is not going to work with it.


You already seem familiar with burning .hex files. So, if you want to use the latest official Digispark board support you need to burn the hex file for Micronucleus version 1.11. I replicated your error, but using an OLIMEXINO-85-ASM which is highly similar to the Digispark but may not be identical. After programming micronucleus-1.11.hex the board worked with the official Digispark board support package.


However, you could also just abandon that old official package and use ATTinyCore which does come with a Micronucleus bootloader new enough to program the Digispark board with Micronucleus 2.6. I tested that as well.


You can replace the Micronucleus tool with a newer one in your arduino15/packages/digistump/tools/micronucleus/2.0a4 directory. Incidentally, I have no idea where the 2.0a4 comes from, but it is not indicative of a Micronucleus 2.0 in any way that I can tell.


For testing I put the 2.6 firmware on the board, specifically the t85_default.hex file, and stole the Micronucleus tool out of the latest ATTinyCore board packages tools directory, by renaming the existing file an symbolically linking in the other one:


Digispark is small Arduino IDE compatible development board based on the Atmel attiny85 that directly connects to USB. It has very few pins, but still can do some neat things. Digispark is copyright by Digistump LLC (digistump.com) and the full license is here: Policy


There are some good tutorials out there on setting up a new Digispark environment, but the ones I found were all geared toward having a completely separate Arduino IDE. If you already have Arduino 1.6.x installed and working, and just want to add Digispark support to that environment without having to create a second Arduino IDE just for digispark, then this tutorial is for you.


Additionally I'll show you how to add support for burning the micronucleus bootloader, the one used by the Digispark, into a new attiny85 from the Arduino IDE, something that current Digispark IDE doesn't allow you to do.


Download the digistumpIDE zip file from the digistump website (Digistump Software), do not download the installer version, you want the zip file version. At the time of this writing, the file name of the current version was digistumpide1.5.8c.zip. The downloaded file is a complete Arduino IDE, but we only need the parts for digistamp support since were assuming you already have a working 1.6.x Arduino IDE installation. From inside the zip, extract hardware/digistump directory into [home]/hardware directory (usually in My Documents/Arduino/hardware). The extracted directory tree is large at 67MB and since we are only looking to add digistamp, you can delete the [home]/hardware/digispark/avr/sam" tree which takes up 60MB and already exists with the base Arduino IDE installation.


This driver is used to talk to the micronucleus bootloader on the attiny85 to load sketches into the device. It can be installed either from the digistumpIDE download, or you can download it from the micronucleus git hub which is what I chose to do (Micronucleus site). The file is called micronucleus-t85_winDriver.zip. Unpack this to some location on the PC and run the "installer_x86.exe". If you want to use the one bundled with digistump, find DigisparkWindowsDriver\InstallDriver.exe that is part of the digistump download in step 1, extract that directory tree and run the installer. If you have issues with the driver, these can often be fixed with a program called Zadig.


By default, the Digistump/Arduino IDE does not support installing the bootloader on a new attiny85. It's fairly simple to add this support to your existing Arduino IDE. Building your own "digispark on a breadboard" isn't too difficult either and just requires a few components, but I won't be covering it here as it's covered in other people's tutorials. Support for the digispark pro using micronucleus v2 can also be added, but I don't have a Digispark Pro board to test it with so it's not included here. Instructions on how to manually install the bootloader on a digispark pro are located here Digispark Pro bootloader.


Download the bootloader hex file from the micronucleus git hub site, use either the micronucleus-1.06.hex or micronucleus-1.11.hex. The 1.06 version has had more extensive testing with digispark, however I'm using 1.11 which has worked fine so far. Under [home]/hardware/digistump/avr create a directory called "bootloaders" and place the micronucleus-1.11.hex (or micronucleus-1.06.hex or both) file in it. If you choose to use the 1.06 version, be sure to modify the digispark-tiny.bootloader.file parameter below as appropriate.


Note: Unlike with a purchased Digistamp, the fuse settings above do not make the reset pin available for I/O. If you wish to use PB5 of the chip for I/O, change the High fuse to 0x5D, but understand you will no longer be able to use an ISP to program the chip such as an Arduino as ISP or USBasp, you will need high voltage serial programmer (HVSP), significantly reducing your options if you brick the chip.


To actually burn the bootloader, you will need an ISP programmer. Most people use an Arduino UNO or similar, load the ArduinoISP sketch, and wire up a simple breadboard to do the programming. There are many tutorials that do a great job describing how to do this so I'm not going to cover those details here. Other AVR ISP programmers can also be used that the Arduino IDE supports.


Assuming you have a working Digispark, either one you purchased or one you built on a breadboard, it's now time to upload a sketch. One thing that is different from other Arduino development boards is that the digispark must be disconnected from the USB port until the upload process requests it be plugged in. If you leave it plugged in and try to upload, it will fail with an error message.


In the Arduino IDE select your board as "Digispark (Default - 16.5mhz)" in the tools menu and your programmer as "micronucleus". Compile and upload in the Arduino IDE as usual, wait for the instruction to plug in device then plug in in the bottom of the IDE window (black background portion). If all went well, programming will complete without error. It's also possible to upload outside the IDE using micronucleus.exe passing the file name of your compiled program in intel hex format.

3a8082e126
Reply all
Reply to author
Forward
0 new messages