-2
\$\begingroup\$

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?

\$\endgroup\$
4
  • \$\begingroup\$ How much money did you save going to this "reputable" Chinese supplier? (you don't need to answer). \$\endgroup\$
    – Andy aka
    Dec 14, 2015 at 9:14
  • \$\begingroup\$ @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. \$\endgroup\$ Dec 14, 2015 at 9:32
  • 1
    \$\begingroup\$ What about the lock bits? \$\endgroup\$ Dec 14, 2015 at 14:42
  • \$\begingroup\$ @IgnacioVazquez-Abrams: yep, lockbits! That's exactly what I forgot about, thanks! \$\endgroup\$ Dec 15, 2015 at 9:44

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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