I bought 40 attiny13a chips from china but after receiving them, I couldn't program them with my USBasp programmer. I tried all of them with the same result - chips did not respond to the programmer. I quickly constructed Arduino based high voltage programmer using bunch of resistors and a transistor based on this link so I could read the fuses. They are not set to default values - RSTDISL and both BOD bits are set, so the high fuse is 0xF8.

Problem is, I can't change those fuses with the same programmer even though it can read chip signature correctly and fuses values also seams sane. When trying to change fuses nothing happens, microcontroller seems to be ignoring the commands.

Exactly the same setup works for my older chips (I can change fuses without problems), though, so I think my DIY programmer does work. The seller claims that the chips are ok and my circuit has to be faulty. Am I missing something here or all 40 chips are broken in this strange way?

  • How much money did you save going to this "reputable" Chinese supplier? (you don't need to answer). – Andy aka Dec 14 '15 at 9:14
  • @Andyaka: Let me answer anyway, as probably you're not the only one with this kind of comment. If I include shipping costs, it was almost one third of a price. It's for hobby projects only so quality is not important to me as long as it's working. But I don't regret doing this transaction, I just want to learn as much as I can from it. – Krzysztof Adamski Dec 14 '15 at 9:32
  • 1
    What about the lock bits? – Ignacio Vazquez-Abrams Dec 14 '15 at 14:42
  • @IgnacioVazquez-Abrams: yep, lockbits! That's exactly what I forgot about, thanks! – Krzysztof Adamski Dec 15 '15 at 9:44
up vote 1 down vote accepted

As pointed out in the comments to my question, lockbits can prevent changing fusebits. Attiny13a have 2 such bits and their meaning is described in the datasheet in 17.1 Program And Data Memory Lock Bits. If either of them is set:

Further programming of the Flash and EEPROM is disabled in
High-voltage and Serial Programming mode. Fuse bits are
locked in both Serial and High-voltage Programming mode.

The only way to unlock the chip is to run Chip Erase command, either using SPI programmer (described in 17.6 in datasheet, can be done with avrdude using -e option) or high voltage programmer (described in 17.7 in datasheet). In my case, since RSTDISL fusebit was set, SPI programming was not available and HV programming was the only option. I created Arduino based programmer and modified some code that reads/sets fuses to also call Chip erase command according to table 17-13 from the datasheet.

Here's the Arduino program I have used to erase the chip.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.