First-timers playing with 8-bit micros such as the AVR and PIC will at some point in their lives, find themselves locked out of their MCUs. This is usually attributed to badly configured fuses that disable certain IO functions rending the device unprogrammable via conventional ICSP methods. [Uri Shaked] shares his story of how his ATtiny85 got locked and became the subject of a lengthy investigation into fuse bit configurations.
[Uri]’s journey started when he accidentally left some pins of the device connected to a second board while he was flashing the firmware. He quickly researched online for a solution for the problem and it turns out, there are a number of recipes to resolve the issue. As it turns out, his problem was not so straight-forward and warranted more digging. [Uri] ended setting up a High Voltage Programming serial programming setup and then probing the communications. He discovered that the chip refused to reset its fuses and would reject attempts to set fuses.
Further investigation of the fuse bits and reading them proved useful in understanding that the memory protection features were preventing alteration of the device. The quick-fix was to erase the ATtiny and things were back to normal thereafter. [Uri] details his pursuit of reading and comparing fuse bits from the impacted chip against a fresh device which is where he makes the discovery. The write-up is a case study in the investigation into the idiosyncrasies of device programming and will be a great resource for many and reduce hair loss for some.
Once you get your hands on an ATTINY, there are a number of small experiments to be done to cure boredom. Be sure to share your experiments and stories with us to inspire the masses.
That’s a nice writeup, I could really have used it when I bricked my first mcu :-)
i remember on one at micro (i dont remember which) i accidently programmed an undefined fuse, and have never been able to unset it. it works but it will always fail the fuse verification pass.
i think one time i re-programmed one of the undefined fuses on an atmega (i dont remember which). all attempts to change the fuse back to default had failed. the chip did its job ok but it would never pass verification on the fuse bits.
So, when he used the device as per the datasheet it worked as expected.
Is that it? Or I’m missing something here?
Not sure about you, but when I was getting started in electronics I had more curiosity to play with things than patience to read an entire MCU datasheet.
I’m certain you’ve never made a mistake before
That’s it, but it’s useful info that might help save other people hours of frustrated debugging (or, more realistically, save others from throwing away a perfectly good part).
If something is mentioned once, in paragraph 3 of page 396 of a 800 page document, does it really qualify as being “documented”?
Some datasheets are so bad, you need to trawl through several application notes to have any real idea of how to implement a device.
…does it really qualify as being “documented”?
Not in my world. I have several mcu’s laying around that never got much further than basic arduino environment programming, though I originally had much higher hopes for them…until I spent a couple hours looking through their “manuals”.
They can’t even usually get the order of contents correct. Chapters seem haphazardly written, compiled, or translated by different people across the globe who don’t even appear to directly communicate with each other. Many chapters have overlap, many have the same gaps. There is a price to be paid for these cheap micros.
On the other hand, I was able to program a cheap, but relatively powerful fpga – though it took a ~$100 non-official book that explained things very clearly. Silicon gets cheaper, but quality documentation commands increasing prices.
@Alan said: “If something is mentioned once, in paragraph 3 of page 396 of a 800 page document, does it really qualify as being “documented”? Some datasheets are so bad, you need to trawl through several application notes to have any real idea of how to implement a device.”
If you are working in a real company that makes real money and you don’t read that huge stack of documentation, and then leave something critical out of the product you developed – you’ll (at-best) get fired. But then again, they never give you enough time to read and understand all that documentation and still meet the development deadline. It’s no way to live. But that’s the way it often is, especially when you have non-technical egotistical leadership running a company that makes high-tech products.
Ah ha, helpful update thanks, wonder if something similar re the dirt cheap Taiwanese/Chinese 1c parts ?
Thanks for post, looking forward to comments, cheers
Unless you live under a rock, you’ve had your own problems with programming AVR chips. Mine was when I needed to program 550 chips with a home made adapter. Tooks me weeks until I realized that the chips wouldn’t work without an external XTAL. Having only programmed a half dozen other types of chips without that problem, I was shocked that the default settings from the factory required an external clock source.
I feel sorry for people trying to program these chips in bulk. (Oh, and the support people took forever to respond to my sample request. The project was done and shipped before they ever replied to my sample requiest).
Fuse programming issues are not unique to Atmel (Microchip).
Certain Xilinx FPGAs contain polysilicon fuses that can blow if the power rail sequencing isn’t done correctly. This leads to odd, unrecoverable conditions such as a dual core ARM processor only having a single core available. [There are cheaper variants of the device that only expose a single ARM core; these share die with the more expensive parts and the fuse that controls that is only meant to be blown at the factory.]
I learned this from reading the Xilinx forums and Xilinx Answer Records. It hasn’t happened on any of my boards (yet, fingers crossed). Who knows what might happen if accidentally I drop a screwdriver onto a board though.
Most efuses are PITA as they are not write accessible from within the firmware.
ARM chps seem to have the bare minimum as things like clock and GPIO configurations are programmable in registers. STM8 efuses can be reprogrammable from firmware just as onchip EEPROM or FLASH.
not a bricking but;
i once fed 12v into analog reference pin on an atmega1280, not sure which ref. was selected, but i thought the analog comparator and ADC could be referenced to more then VCC because the datasheet section devoted to ADC left out this important number and only said “see appendix” hmm must not be all that important? safe to assume the max is more then my 12v?
it didnt break, but external option no longer works AND chip now uses significant amount of current and heats up. im suprised i didnt damage it from subsequent projects that drew a fair amount of current that when combined with the excess wasted current might have violated the max dissipation or current to power/ground.
it now runs at about 40 or 50 deg. celcius with no loads/projects (ambient=22deg.celcius)
at a reasonable 16mhz out of a possible max of 20mhz (arduino) (@5v)
PS: the datasheets are nearly useless for newbies NOT using assembler, unless your willing to dig and study each subrotine aka high-level command, but to do that you still need to understand assembly. for those using it, datasheets are really only 3 pages per subject plus one or two tables of values,,, usually in a different section tho. like in my case the max voltage allowable into this pin IS MISSING FROM THE SENTENCES THAT ARE ACTUALLY IN THE ADC CHAPTER… such wasted writing, need to search appendix for the digits THAT BELONG IN SECTION DEVOTED TO IT.
PPS: there are sometimes TWO versions of MCU datasheets, the 5 page version and the one we call a manual. EG Atmega328.pdf is 599kb and Atmega328-328P.pdf is 5.16mb
My first major microcontroller project (senior design project for EE degree) was based on a PIC part. As our device was battery powered we were running with Vcc of 3V. We couldn’t get our breadboard to do anything until we accidentally forgot to change the lab power supply down to 3V from the 5V that the previous users had it set on. It “magically came alive”. Turns out there was a note in the data sheet that to run with lower Vcc than 5V, the brownout detector fuse had to be disabled. That was after a day or two of hair pulling!
Never buy an ATTiny. Buy a tube or reel of ATTinys!