How to override avrdude error?

Hello. I am trying to upload a sketch through an Arduino Mega to an ATMega328-PU. Because this is not the P-PU I get errors about incorrect device signatures. I was able to bypass this when burning the bootloader by changing part of the signature in the avrdude.conf file from 0F to 14, making it recognize the 328-PU. However, when I try to upload a sketch by going to File -> Upload using programmer, I still get a signature error, using either the old or new signature. It says I can bypass the check, which would save me lots of trouble, using -F. The only problem is... how do I tell it that command. This probably sounds like a very noobish question, but that is because... well, I am a noob :D Any help would be VERY appreciated.

Any help would be VERY appreciated.

Type the command on the command line.

Bypassing checks with -F is usually a very bad idea regardless of whether you can or not - it's like saying there is a problem with the brakes in your car, but instead of finding the problem, you'll just ignore it and use a brick wall to stop.

What signature are you getting back?

After you have loaded the standard bootloader, change the avrdude config file BACK, and tell everything else that you have an actual 328p. (The bootloader happily lies and tells avrdude that it is a 328p. The compiler doesn’t understand 328, and will generate code for a 328p. Which is fully compatible, as far as anyone has been able to tell. The ONLY time you need avrdude to understand/think that it’s really a 328 is when you are installing the bootloader.)

@westfw I still get a signature error. Specifically:
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
@Tom Carpenter As in the error above, it does not tell me a specific signature. However, I believe previously it did say it was looking for the 328P signature of 1E 95 0F. When I changes the avrdude file to the signature of the 328 it still said it was looking for the 328P signature, but it displayed the signature of the 328 I had changed it to, 1E 95 14. I’m not sure what I did to stop giving me that error and start to instead give me the above one.
@PaulS The Windows command line? Or some hidden Arduino command line? When I try with windows to put avrdude [-F] I get a response saying I have to use -c to specify a programmer. I do not know how to tell it to talk to the Arduino programmer.

In the IDE preferences, enable verbose output during upload. That will tell you what signature avrdude is reading back. It sounds more like an issue with connections. The -F option is rarely if ever useful (car, brick wall).

Binary sketch size: 3,468 bytes (of a 30,720 byte maximum)
C:\Program Files\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\.\COM4 -b19200 -Uflash:w:C:\DOCUME~1\COMPAQ~1\LOCALS~1\Temp\build4926892092043083659.tmp\Reciever.cpp.hex:i

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is “C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf”

Using Port : \.\COM4
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA328P
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 1024 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: Send: P [50] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################################## | 100% 0.06s

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

avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done. Thank you.

I’ve included pictures of my setup (sorry for bad photo quality)

HNI_0040.JPG

HNI_0041.JPG

The ground wire for one of your two capacitors next to the crystal seems to be in the wrong place

Furthermore, if you want to use a MEGA board as the USB-Serial adapter, you need to put a wire from the RESET pin of the Mega to GND so that the chip doesn't start interfering with the TX/RX lines.

Also remember that the TX on the MEGA board needs to go to the TX on the ATMega328 (and RX to RX) - there is no crossover needed as that is done on the PCB of the MEGA board.

You were right about the capacitor. However, The RX and TX lines see fine to me. I put different color wires so It’s easier to see the difference. And as for reset, don’t I need to connect it to the reset on the 328? That’s how it is according to http://arduino.cc/en/Tutorial/ArduinoToBreadboard, with it connected to 5V with a 10K resistor. With the Mega do I just not do that?

HNI_0042.JPG

HNI_0043.JPG

I don't see anything in your picture that will keep the MEGA CPU from interfering with the serial communications to your 328. The usual recommendation when using an Uno is to remove the chip.

The "siganature = 0" is what I get if I set an upload talking to ArduinoISP with no chip connected to the SPI connector, so I suspect that you're still running ArduinoISP on your MEGA, and the upload is talking to the MEGA instead of to the 328. Or something like that.

You might be able to load some sort of "null" program on the MEGA that turns off its serial communications...

The new error after changing the capacitor problem is :avrdude: stk500_getsync(): not in sync: resp=0x00

westfw: I don't see anything in your picture that will keep the MEGA CPU from interfering with the serial communications to your 328. The usual recommendation when using an Uno is to remove the chip.

The "siganature = 0" is what I get if I set an upload talking to ArduinoISP with no chip connected to the SPI connector, so I suspect that you're still running ArduinoISP on your MEGA, and the upload is talking to the MEGA instead of to the 328. Or something like that.

You might be able to load some sort of "null" program on the MEGA that turns off its serial communications...

Apart from the fact that the mega has a bootloader which will drive the Tx line because it is set to be an output.

Does this mean that if I don't want to buy an external programmer or Uno, I would need to hand remove the microcontroller and either hand resolder or reflow it back on? :/

Or perhaps I can get by just removing the connection for the TX and RX in the microcontroller?

You have two options - either wire the RESET of the Mega to ground and have a push button connected to the reset pin of your ATMega328 (manually push the button just before upload). Or don't bother with a bootloader and just use ISP to program.

The "null" program I had in mind would disable serial on the MEGA:

void setup() {
  pinMode(0, INPUT);
  pinMode(1, INPUT);
}
void loop() {}

It'd be a minimal effort to give it a try...

I already loaded the bootloader. My problem is with loading the sketch

I know that.

@Tom Carpenter I tried the rester thing you said and still got an error (Well, sort of… I didn’t have a through-hole push-button available, so I made a ghetto setup and connected a wire when I would push the button XD. It still does the same thing, right? I tried multiple times just in case messed up connecting the wires. Included is pictures of my updated setup).
@westfw I still got the error again.

The error in both cases was “avrdude: stk500_getsync(): not in sync: resp=0x00”.

HNI_0044.JPG

HNI_0045.JPG

HNI_0046.JPG

HNI_0048.JPG

As the write for the crystal was in the wrong place, I'd be concerned that burning the bootloader won't have worked (the IDE just says 'done' but doesn't clearly state if it was a success for a failure). The reason is that the first thing that happens is the fuses get changed to 'external crystal', then the bootloader is installed - this means if the crystal wasn't attached, it would change the fuses and then not be able to program the bootloader.

You can test this by adding an LED to pin19 on the atmega328 chip. If that flashes when you reset with your bit of wire, then the bootloader is fine. Otherwise try running burn bootloader again, and then try testing upload again.