1

Following on from this question, Problem with programming an ATtiny85: Error - avrdude: Yikes! Invalid device signature, if the response from avrdude is 0x000000 then the internal oscillator is probably not being used and an external one (be that crystal or clock signal) is required.

However, as this menu, from Engbedded Atmel AVR® Fuse Calculator, shows, there are a lot of options:

ATtiny85 oscillator selection

So, instead of having to configure circuits for each of the options, in turn, until the ATtiny responds, is there any way that I can read which of the CKSEL and SUT fuses are set?1


Background

I am using a Nano/Uno as an ISP programmer, and the ATtiny is on a dev board like this (although it would be the same issue if I were to use a breadboard):

ATtiny development board

I know for sure that the connections are fine as I have checked them from pin to pin of the two ICs (ATmega328PU to ATtiny85), using a DMM.

I am receiving 0x000000 as in:

     avrdude: Device signature = 0x000000
     avrdude: Yikes!  Invalid device signature.
     Double check connections and try again, or use -F to override
     this check.

because the ISP programmer can't read the ATtiny, because an external clock source has been set via the fuses. However, I wish to know how to read which clock source has been specified, without having to manually try all of the circuit permutations.

I don't think that just connecting a crystal (and two ceramic capacitors) will work if the exact setting, i.e. external clock, has been selected. However, if a 16MHz crystal works for all, or any, of the external clock settings then that would be great, but I'm sure it doesn't work like that, as you can have a crystal attached but the it might not be used, see Does device signature 0x000000 mean the atmega is bad:

Even though you have a crystal connected, that does not mean it is oscillating. For example, IF you set fuses for "External Oscillator", that will turn the crystal oscillator off.

When I move the ATtiny85 to a breadboard and add a crystal (16 MHz) and two 22 pF capacitors, the error has changed for the better (at least now it sees that a ATtiny is connected)

avrdude: Device signature = 0xff0000
avrdude: Expected signature for ATtiny85 is 1E 93 0B
         Double check chip, or use -F to override this check.

Interestingly the signature varies:

  • 0xff0000
  • 0x00ffff
  • 0xff00ff

When I add an external power supply to the ATtiny on the breadboard, following advice from Atmega (any chip) Device Signature issues and stk500_getsync()(resolutions), then unfortunately the device signature in the response returned by avrdude reverts back to 0x000000

     avrdude: Device signature = 0x000000
     avrdude: Yikes!  Invalid device signature.
     Double check connections and try again, or use -F to override
     this check.

ATtiny85 on breadboard and Nano as ISP


1 This is, admittedly, a bit chicken-and-egg, as if I can't communicate with the ATtiny, due to the incorrect clock setting, then how can I read which fuses have been set..? It's a bit like saying "If I don't have petrol in my car, then how can I drive to the petrol station to fill up?" - but I was hoping that there might be some sort of time saving measure

  • How are you powering the Attiny during programming? Extra capacitor on VCC-GND? forum.arduino.cc/index.php/… – Mikael Patel May 9 at 13:48
  • The USB port on that board is only used for power! You can't program the ATTiny over that USB port. – Gerben May 9 at 16:37
  • @Gerben - I am using the ICSP pins and a Nano as the ISP programmer. Once you get the micronuleus bootloader installed then you can use the USB port to program it... see Breathing life into the DigiSpark clone with ATtiny MCU – Greenonline May 10 at 8:53
  • @MikaelPatel - No I didn't have one of those... interesting... I added a 20 uF, but still the same random signature errors... I notice that in the link, an external supply is recommended, in addition to the extra cap. However, when I added the regulator and additional cap, then situation regressed and the device signature reverted back to 0x000000, unfortunately. – Greenonline May 10 at 8:59
  • 1
    It could be that the ISP-disable fuse is set. I've had some ATTiny13s from China that had their fuses preprogrammed, which made them unusable. I build a simple High Voltage Programmer, to reset the fuses. I think I used this code and schematic github.com/tsaarni/avr-high-voltage-serial-programming. Pretty simple circuit. Only two resistors and a transistor. For the 12V source I just stacked 4 CR2032 coincells on top of each other, holding two jumper wires at both end with one hand. Very hacky, but it worked. – Gerben May 10 at 13:27
2

This seems to be an X -> Y problem, with X being the missing clock source on your ATTiny, which prevents communication.

If you have a second Uno or other AVR device, you can use that to generate a clock signal on any of the digital pins:

void setup() {
  DDRB = 0b00100000;  
}

void loop() {
  PINB = 0b00100000;
}

This creates a square(~ish) signal on Pin 13 with a frequency of 1.6 MHz. Depending on the IDEs optimization level (platform.txt), a frequency of 4 MHz is also achievable (at -O3 instead of -Os).

Connecting this to the XTAL1 pin of your ATTiny85 should allow you to communicate with the board. Make sure to interconnect all grounds.

0

You need a Programmer that connects to the ISP pins

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

The programmer will hold Reset low, then communicate via the SCK/MOSI/MISO pins to read/update the fuses, read/program memory, and optionally read/program the EEPROM.

Section 20.2 discusses the 3 fuse bytes.

I use an older Atmel AVR-ISP MKii. Atmel stopped making them, there seem to be plenty of replacement choices available, and Atmel Studio 7 when I struggle with Atmega328P, '1284P, and 2560. I haven't used an Attiny in a project yet.

https://www.microchip.com/mplab/avr-support/atmel-studio-7

  • I obviously wasn't clear in my question. I am using a Nano/Uno as an ISP programmer. I am receiving 0x000000 as in avrdude: Device signature = 0x000000 because the ISP programmer can't read the ATtiny, because an external clock source has been set via the fuses. However, I wish to know how to read which clock source has been specified, without having to manually try all of the circuit permutations. This is, admittedly, a bit chicken-and-egg, as if I can't communicate with the ATtiny, due to the incorrect clock setting, then how can I read which fuses have been set..? – Greenonline May 9 at 12:10
  • 1
    I think you just need to supply a clock, easy way is to connect a crystal and two 22pF caps. Read here, Nick Gammon goes thru a lot of the fuse settings stuff. gammon.com.au/forum/?id=11643 – CrossRoads May 9 at 12:30
  • I was thinking that it might not work if the exact setting hasn't been selected, if a 16MHz XTAL works for all or any of the external clock settings then that would be great, but I'm sure it doesn't work like that, as you can have a XTAL attached but the it might not be used, see Does device signature 0x000000 mean the atmega is bad: Even though you have a crystal connected, that does not mean it is oscillating. For example, IF you set fuses for "External Oscillator", that will turn the crystal oscillator off. – Greenonline May 9 at 12:35
  • 2
    The best way to know for sure is to use a High Voltage (12V) Programmer to reset everything. gammon.com.au/forum/?id=12898 – CrossRoads May 9 at 14:54
  • 1
    Sure, see section 20.7 of the data sheet and Table 20.16. If I recall, you have to do a Chip Erase before you can Reset the fuses. – CrossRoads May 9 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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