0

I keep getting a device signature error and can't program my Atmega168pa chip.

I'm using the board from: https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json

I've pasted the error below from an attempt to upload a new sketch:

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}
Arduino: 1.8.13 (Linux), Board: "ATmega168, No bootloader, EEPROM retained, 168P / 168PA, BOD disabled, LTO Disabled, Internal 8 MHz"

Sketch uses 412 bytes (2%) of program storage space. Maximum is 16384 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 1015 bytes for local variables. Maximum is 1024 bytes.
/home/rick/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/rick/.arduino15/packages/MiniCore/hardware/avr/2.0.7/avrdude.conf -v -patmega168p -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:/tmp/arduino_build_51999/sketch_nov15a.ino.with_bootloader.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/rick/.arduino15/packages/MiniCore/hardware/avr/2.0.7/avrdude.conf"
         User configuration file is "/home/rick/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega168P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no        512    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     16384  128    128  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

An error occurred while uploading the sketch
Reading | ################################################## | 100% 0.02s

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


avrdude done.  Thank you.

Pictures of my wiring:

My wiring

I have:

  • D13 -> (PCINT0/CLKO/ICP1) PB0 [Pin 14]
  • D12 -> PB4 (MISO/PCINT4) [Pin 18]
  • D11 -> PB3 (MOSI/OC2A/PCINT3) [Pin 17]
  • D10 -> (PCINT14/RESET) PC6 [ Pin 1]

I have a 100n capacitor between vcc & gnd and between avcc & gnd. I have a 10 uF capacitor between “Reset” and “Ground” pins on the Arduino. Power is fed via the 5v pin from Arduinio.

I know this nano works (I programmed an ATTiny84 with it before and after my attempts on the Atmega). I've checked pwr & gnd. I'm not 100% sure of the wiring. These chips are new from China so I'm not sure if they are configured for internal or external clock, although I believe they are set to internal by default.

2
  • 1
    ISP pins are usually all next to each other. That D13 to PB0 is unlikely to be correct. It should be PB5 – KIIV Nov 15 '20 at 18:31
  • @KIIV, I just noticed your comment here. Write it up as an answer and I'll vote my answer for deletion. – timemage Nov 15 '20 at 18:45
1

The ISP pins are usually all next to each other. The connection D13 to PB0 is unlikely to be correct. It should be connected to PB5.

You can check your connections here: https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoToBreadboard (there is UNO, but pin numbering/wiring is exactly the same as for Nano)

Another possible mistake is burning wrong fuses (with bootloader) for external xtal setting (also mentioned in the article)

1
  • The issue was the D13 to PB0 connection, it should have been PB5. After I moved that everything worked perfectly. Thanks! – Rick Dearman Nov 15 '20 at 21:10

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.