Arduino as ISP issue

Scope: use Arduino Uno R3 as ISP with IDE 1.8.1

Instructions used:

https://www.arduino.cc/en/Tutorial/ArduinoISP http://www.gammon.com.au/forum/?id=11635

When using the ICSP to connect the Uno with a Pro Mini, setting the programmer option as "Arduino as ISP", selecting the correct com port, selecting the Pro Mini Atmega168 5V 16MHz, I open -per instructions- the file I want to download, make sure all settings per above are still correct, and perform ctrl-U (upload).

Error:

"avrdude: expected signature for Atmega is 1E 94 06; wrong microcontroller found"

However, when I use avrdude instructions I have proper communications, the board signature found is 1e940b = ATmega168P nd I can download the program (in hex) to the Pro Mini.

The baud rate in the Arduino (boards.txt) is set at 19200, the same as when using avrdude.

You probably just need to add/alter a new boards.txt entry for your Pro Mini - the signature bytes are different because its a different version of the ATmega168 on the board from previously for some reason (signature bytes change on every chip revision I think, not just basic part number).

MarkT: You probably just need to add/alter a new boards.txt entry for your Pro Mini - the signature bytes are different because its a different version of the ATmega168 on the board from previously for some reason (signature bytes change on every chip revision I think, not just basic part number).

Thank you!

But, now how do I find which boards.txt text "corresponds/has to be used" with the "expected" signature?

And why would the device signature expected by "Arduino as ISP" (1e9406) be different from the one found by avrdude (1e940b)?

Turn on verbose uploading in preferences and copy everything in the output window, and post it here.

Jiggy-Ninja:
Turn on verbose uploading in preferences and copy everything in the output window, and post it here.

the complete output is in the attachment (post exceeded 9000 characters, too much for regular posting in the message);

Below I show what appears in red in the output.

The correct signature is read by avrdude (see below), yet it wants another signature: the one I use when using avrdude “straight”.
When using avrdude “straight” (no Arduino-as-ISP) to upload (I specify Atmega168P, which seems not present in the boards.txt?) and it works.

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Mysafety\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino8/etc/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega168
         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 : Arduino
         Description     : Arduino
         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

Er is een fout opgetreden bij het uploaden van de schets
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e940b (probably m168p)
avrdude: Expected signature for ATmega168 is 1E 94 06
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

verbose upload Arduino-as-ISP on Pro Mini Atmega168.pdf (89.2 KB)

There is also the issue that when programming a bootloader avrdude sees the hardware signature, but when uploading a sketch using avrdude talking to the bootloader, then the signature is that compiled into the bootloader code, which may not be the same as the hardware one (the same bootloader code may be used for different versions of the chip).

So for instance the boards.txt entry needed for AVRasISP use may differ from the one then used to upload sketches.

MarkT: There is also the issue that when programming a bootloader avrdude sees the hardware signature, but when uploading a sketch using avrdude talking to the bootloader, then the signature is that compiled into the bootloader code, which may not be the same as the hardware one (the same bootloader code may be used for different versions of the chip).

So for instance the boards.txt entry needed for AVRasISP use may differ from the one then used to upload sketches.

Maybe then the bootloader is not correct?

I think I understand your comment: when using avrdude it reads the hardware signature. When using "Arduino as ISP" it reads the bootloader signature?

When I use avrdude "straight" (without Arduin as ISP), I use the Avrdudess as GUI, there I use the flash button, and the command -c stk500v1 -p m168p -P COM7 -b 19200 -U flash:w:"C:\Users\Mysafety\Google Drive\documents\arduino\promini_blink\promini_Blink.ino.eightanaloginputs.hex":a

From the command line:

-patmega168

From the error message:

avrdude: Device signature = 0x1e940b (probably m168p)

Well There's Your Problem.jpg

the boards.txt says it should be an ATmega168, but the board has an ATmega168P. You’re using the P part number when you manually use the command line, so it works.

i don’t know an easy fix for it, other than manually creating a boards.txt file with a fixed entry for the MCU.

Jiggy-Ninja: i don't know an easy fix for it, other than manually creating a boards.txt file with a fixed entry for the MCU.

Can you give a link or hint on how to write an addition to the boards.txt file?

Also: I see there is an entry in this file for the atmega328p:

pro.menu.cpu.8MHzatmega328.build.mcu=atmega328p

But on the atmega168 it says mini.menu.cpu.atmega168.build.mcu=atmega168

Put the attached folder in your sketch folder and restart the IDE. There will be a “Fixed ATmega168P Pro Mini board” option in the boards menu.

hardware.zip (1.25 KB)

Jiggy-Ninja: Put the attached folder in your sketch folder and restart the IDE. There will be a "Fixed ATmega168P Pro Mini board" option in the boards menu.

Magic!!

Thank you very much!!

Now is there a way to incorporate this in the existing boards.txt file? Reason is that I need to copy this to a few more computers and it would keep things simpler if I could do this with one file? Also I would like to add a few more versions, with 3.3V and different frequencies: so if this could go in one setup that would be even more magic.

Jiggy-Ninja: Put the attached folder in your sketch folder and restart the IDE. There will be a "Fixed ATmega168P Pro Mini board" option in the boards menu.

Upload works and is ok; just one error shown in verbose output:

Bootloader file specified but not found: C:\Users\Mysafety\Google Drive\documents\Arduino\hardware\brice3010\avr\bootloaders\arduino:atmega\ATmegaBOOT_168_diecimila.hex

It shows to the folder where the file I got from you is stored; there are two files: platform.txt and boards.txt

Is there an issue with the bootloader?

Open the boards.txt file and delete both of the bootloader.file lines.

Jiggy-Ninja: Open the boards.txt file and delete both of the bootloader.file lines.

Fixed!!

Thank you very much. Erik

Jiggy-Ninja: Open the boards.txt file and delete both of the bootloader.file lines.

Now is there a way to incorporate the file I received from you in the existing boards.txt file? Reason is that I need to copy this to a few more computers and it would keep things simpler if I could do this with one file?

It's easier to just copy the hardware folder to each of the computers.

The platform.txt file isn't very necessary, it just provides the title that appears over the board name in the menu.