Go Down

Topic: ATMEGA328P-PU and Arduino Nano as Programmer (Read 3349 times) previous topic - next topic

LlamaLele

Hi, for the last 20 minutes I've been scrolling through the threads here, and have still not found an answer that works for me, so if one of you guys could help me, I would really appreciate it! :)

I've bought a few ATMEGA328P-PU's, and I've been trying to install a bootloader onto them for the last many hours with no luck. I've been using my arduino nano, and have both tried uploading via arduino uno and breadboard to no avail. I have watched countless of videos and read countless of threads, and from what I've gathered, it should be possible to burn a bootloader onto a 328P-PU with just a nano, but everytime i try i get an error. I've mostly been getting the "Expected signature for ATmega328P is 1E 95 0F" error, and yes, I have tried changing the value in avrdude.conf.

What I really wanted to know, is if you guys know a method that works as of today, as most the methods I've been trying are 5-10 years old, and are now outdated. Is it even possible with the ATMEGA328P-PU's anymore? I also have a few that says "ATMEGA328P U" but I'm not sure of the difference. Nevertheless, they both give me the same errors, which are *mostly* the signature error.

Any help or answers are appreciated.
Thanks in advance!

Budvar10

#1
Nov 15, 2019, 08:09 am Last Edit: Nov 15, 2019, 08:10 am by Budvar10
Sure it is possible.

Quote
Hi, for the last 20 minutes I've been scrolling through the threads here, and have still not found an answer that works for me, so if one of you guys could help me, I would really appreciate it! :)
Did you try  Arduino as ISP tutorial (it's here on the web)?

Quote
..."Expected signature for ATmega328P is 1E 95 0F"...error
Notoriously known but what is in the rest of this error? Could you post whole error log?

Depending on the version of  the IDE you are using, the 10uF capacitor between RESET and GND on your Nano could help. However, it is just blind shot.

Quote
I have tried changing the value in avrdude.conf
...and the reason is? How?

ATmega328P mark is important. The "-PU" or whatever is package type but the chip is the same.


R..

...and welcome to the forum.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

Thanks for your reply! :)

Yes, I have tried the Arduino as ISP. I've been using my nano to try and burn a bootloader onto a 328PPU Chip, and as I mentioned, I've tried both plugging the chip into my Uno and a breadboard.
I'm in school right now, so I'll just copy the exact error somewhere from the internet.

Here is the exact error:

avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

Sometimes it'll also say something along the lines of "Something went wrong!" on the first line. But I don't think that's relevant.

My settings are set to Arduino as ISP, board is: Arduino Nano and the processor is set to ATMEGA328.

The settings that I tried altering in avrdude.conf is changing the 1E 95 0F to 1E 95 14, as someone recommended, but I find that it just changes my error message from;

avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

to;

avrdude: Expected signature for ATMEGA328P is 1E 95 14
         Double check chip, or use -F to override this check.

So thats no help. I'll try your capacitator trick, and I'm using the newest version of the IDE.

Thanks!

Budvar10

#3
Nov 15, 2019, 10:34 am Last Edit: Nov 15, 2019, 10:35 am by Budvar10
Again, ATmega328P is important. The 328 differs from 328P or 328PB... Signature have to fit, 328P - 1E 95 0F (this is default Arduino chip), 328 - 1E 95 14 (from MCU's datasheet).

Quote
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.
Not a lot. Go to 'Preferences' and switch on detailed log. Post it. We need to know used command, the values in the response etc.
Because we know what expected signature is (according exact part name) but what was received if anything.
BTW, do not use -F, it is not good advice.

Capacitor probably does not help if you have the newest version.

Post the picture of your connection. It might help. Double check your wiring. There are just 6 wires but you would be surprised how often this is the root cause.

Minimal circuit for ATmega must be. With the breadboard it is important but if you are using UNO board it is fulfilled. Oscillator, reset circuit, power - all power pins connected and decoupling. Decoupling is missing in tutorial but many times was proven that it can be important. So, add 0.1uF to close to each power pin, connected between power pin and GND of course.

Finally, it might look silly, but anyway. Do you have the ISP sketch loaded?
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

I do have the ISP sketch loaded, yeah.

I'll take some pictures and used the detailed log as soon as I'm home, thank you for your reply!

LlamaLele

Hi! So I just connected everything, and I have attached my circuit and the error console on the bottom of the post. Unfortunately I'm still getting the error. My Arduino IDE is version 1.8.10 btw.

All the red and black wires on my circuit are of course VCC and GND, but the rest of my colors are just random.

Quote
Minimal circuit for ATmega must be. With the breadboard it is important but if you are using UNO board it is fulfilled. Oscillator, reset circuit, power - all power pins connected and decoupling. Decoupling is missing in tutorial but many times was proven that it can be important. So, add 0.1uF to close to each power pin, connected between power pin and GND of course.
Also, I didn't try this as I didn't really understand what you meant by it. Could you explain or send a link to someone who does? Thanks!

This is the exact tutorial I followed: http://www.martyncurrey.com/arduino-nano-as-an-isp-programmer/. Though, I am a bit worried that it's outdated... (I didn't follow the part where he edited the boards file, as I was told not to by someone else)
If you don't wanna look through his tutorial, this is the sketch i followed:



I DID remember to upload the Arduino as ISP sketch first, so that's not the problem. I also know that the ATMEGA328PPU works, because the green indicator lights up for a tiny bit when trying to burn bootloader.


Extra Info about IDE settings when I'm trying to burn the bootloader:
Board: Arduino Nano
Processor: ATmega328P
Port: COM8 (Which is definately the correct port)
Programmer: Arduino as ISP

Thanks! :)




Quote
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM8 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

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 "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         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
           flash         65     6   128    0 yes     32768  128    256  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

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x0000ff
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.


westfw

Try this tutorial:  http://www.gammon.com.au/breadboard
Note that unlike the drawing you posted, it has "0.1uF bypass capacitors" mounted near the target cpu.
Those are pretty important, and it's sad that many tutorials don't include them :-(

LlamaLele

#7
Nov 16, 2019, 01:44 pm Last Edit: Nov 16, 2019, 01:46 pm by LlamaLele
Hi, I just deleted my post where I stated that I didn't have any 0.1uf capacitors, go ahead and ignore that. I found some. So I connected everything as described, unfortunately though, it doesn't work...

This is the error I get:

Quote
Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Nov 16 2019 at 13:40:26 with Arduino IDE 10810.
Attempting to enter ICSP programming mode ......................................................
Failed to enter programming mode. Double-check wiring!
Programming mode off.
I'm gonna try purchasing another Arduino Uno and see if that helps to use, instead of a nano.
I have attached a pic of my circuit, if you wanna have a look at what it looks like.

Anyway, thanks for your reply.

Edit:
I thought I just wanted to let you know that my settings are:
Board: Arduino Nano
Processor: ATmega328P
Port: COM8
Programmer: AVRISP mkll

Budvar10

Command looks good and as I supposed, you need not 10uF cap on the Nano, Anyway, you are missing reset circuit, 10kOhm pull-up resistor on RESET pin must be. Plus, it is good to have isolation capacitor 0.1uF on reset wire (yellow) which will shorten the reset pulse and, in this case, the diode in parallel with resistor in backward direction to the Vcc to cut off undershot from reset pulse. See the Arduino schematics for reset circuit.

Response with 0 and FF points to problem with some shortage or floating wire but first, you care the RESET pin and we will see.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

#9
Nov 17, 2019, 02:43 pm Last Edit: Nov 17, 2019, 03:09 pm by LlamaLele
Update!

I think I made it work, thanks to you! :D


I can now burn the bootloader, and it gives me a long successful message.
Now I'm also able to upload sketches via the programmer!
Just one issue. When I upload the blink sketch, everything works good on the breadboard and the LED connected to pin 19 works, but when I plug it into my Arduino Uno, the sketch doesn't work and the BUILTIN led doesn't light up at all, and the reset button doesn't work. Do you know why that is?

Quick edit: Unfortunately, when I plug my recently burned ATmega328PPU chip into my Arduino Uno (elegoo), I'm unable to upload anything to the chip. This is the log when I try:

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 "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM6
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x7c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x7c

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

Budvar10

But what was wrong?

Quote
When I upload the blink sketch, everything works good on the breadboard...
Via ISP?

The error looks similar like problem with serial speed. Are you sure the bootloader is for UNO.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

Quote
Via ISP?
Yes, I have it set to Arduino as ISP, if that's what you're asking. I then select the blink sketch, and press upload using programmer, and it seems to work.

Quote
The error looks similar like problem with serial speed. Are you sure the bootloader is for UNO.
What do you mean by this? Is there any way to get the right bootloader to make it compatible with the UNO? I thought the Nano and the UNO used the same bootloader. Sorry I'm not very educated on that front  :smiley-confuse:

Budvar10

Quote
Yes, I have it set to Arduino as ISP, if that's what you're asking. I then select the blink sketch, and press upload using programmer, and it seems to work.
Once you have uploaded a sketch via ISP the bootloader has gone. Do you know? In such case, you have to upload the bootloader again.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

Oh I didn't know, thanks! Thats no problem I guess :)

Good day to you, and thanks a lot for your help.

LlamaLele

Once you have uploaded a sketch via ISP the bootloader has gone. Do you know? In such case, you have to upload the bootloader again.

Actually, I do have one question. Does that mean I can't burn the bootloader on a breadboard, and then put it in a UNO and upload something from the UNO? Cause that doesn't seem to be working for me.

Go Up