Go Down

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

Budvar10

#15
Nov 17, 2019, 08:55 pm Last Edit: Nov 17, 2019, 08:58 pm by Budvar10
No. You can burn the bootloader on the breadboard and it will work in UNO. You can burn the bootloader to ATmega directly in UNO. There is ISP header.
I am writing just about situation when a sketch is written via ISP. Previously written programs are erased include the bootloader. In other situation, if the sketch is uploaded via USB/serial the bootloader is needed for it and it stay untouched because the boot region (a part of memory for bootloader) in flash is write protect.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

pert

Is there any way to get the right bootloader to make it compatible with the UNO?
The best way to do that is to select Tools > Board > Arduino/Genuino Uno before you do the Burn Bootloader. This is a little bit confusing because you have to have the Nano selected from the Tools > Board menu to upload the ArduinoISP sketch to the Nano, but then when you are doing the Burn Bootloader step you should select the board associated with the bootloader you want to burn to the target chip.

I thought the Nano and the UNO used the same bootloader.
It's a bit complicated. The official Nanos made pre-2018 and the Nano derivatives made even today use a different bootloader. The official Nanos from 2018 and newer do use the same bootloader as the Uno, but they still have a different boot section size so they still aren't interchangeable. For this reason, when you are using a modern versions of Arduino AVR Boards you will find a Tools > Processor > ATmega328P option (which is for the new official Nanos) and a Tools > Processor > ATmega328P (old bootloader) option (which is for the old official Nanos and the Nano derivatives). If you're using an old version of Arduino AVR Boards then you will not have a Tools > Processor > ATmega328P (old bootloader) option and the Tools > Processor > ATmega328P option will be the equivalent of the old bootloader option. The simple answer is to just use the Tools > Board > Arduino/Genuino Uno option, which will free up 1.5 kB of precious flash memory. If you do insist on using the Nano board option when burning the bootloader then make sure you also use that same selection when you're uploading to the chip.

LlamaLele

#17
Nov 19, 2019, 06:30 pm Last Edit: Nov 19, 2019, 07:10 pm by LlamaLele
Quote
The best way to do that is to select Tools > Board > Arduino/Genuino Uno before you do the Burn Bootloader. This is a little bit confusing because you have to have the Nano selected from the Tools > Board menu to upload the ArduinoISP sketch to the Nano, but then when you are doing the Burn Bootloader step you should select the board associated with the bootloader you want to burn to the target chip.
Hey, thanks for the response. Could you help?

Edit: I mean, I burn the bootloader from my nano onto a 328PPU on the breadboard, then remove the 328PPU chip, and insert it into my uno, and then it gives me the following error:


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=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x2e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x2e

avrdude done.  Thank you.

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


pert

Make sure you have the same Tools > Board menu selection (and Tools > Processor as well, if your board selection was the Nano) as you had selected when you did the Burn Bootloader process when you are doing the Upload.

LlamaLele

Unfortunately, this does not work... I've tried burning the bootloader as Uno and as Nano, but everytime i plug it into one of my Unos, the sketch uploaded won't work. Even if it's just the plain bootloader, and no sketch, it gives me the error i posted above.
The thing is, it works perfect in a breadboard. So I don't know what could be causing this error. It's like my Uno doesn't even recognize it.

I did as you described, unless I have to use the same port as well? I'm guessing that doesn't matter at all. I use a different programmer as well, of course, as I can't use "Arduino as ISP" when uploading a sketch on my Uno...

Budvar10

#20
Nov 27, 2019, 08:04 am Last Edit: Nov 27, 2019, 08:05 am by Budvar10
Quote
The thing is, it works perfect in a breadboard. So I don't know what could be causing this error. It's like my Uno doesn't even recognize it.
Weird. Usually it is opposite. Are you sure you plug 328P in correct orientation? UNO has ICSP connector so you could try Arduino as ISP directly in UNO instead of in the breadboard.

The board is providing for MCU this:
1. power - VCC,GND, decoupling,
2. clock - crystal/resonator, it must be for stantard UNO config otherwise MCU won't start,
3. RESET - must be pulled-up and reset signal have to pass from the USB, you should observe triple fast flick on the L LED as the bootloader starts after power up, USB connect or reset,
4. serial line on Rx/Tx they have LEDs, you can observe an activity during communication.
This is about HW. Did I forget anything?

SW - setting have to be correct:
1. fuses,
2. the bootloader for correct MCU type, clock and serial transfer speed,
3. same appropriate settings for upload.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

LlamaLele

Hi... I feel pretty dumb right now, but also happy. I made it work. Like you said, I hadn't plugged my chip in the right way...

Thanks for all your help! Success!!!

Budvar10

Truly, I was out of ideas. :D
You have to stop at this time and start from the beginning.
I am glad you have success. 
Have a nice day.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

Go Up