1

I ran into the following error with a recent Arduino IDE version (1.8.9) when trying to upload to an "Arduino Nano" clone (ATmega328P):

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x18
...
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x18
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

The problem could be resolved by choosing "ATmega328P (Old Bootloader)" as Processor in the Tool menu - as now suggested to me and solved in Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding.

The change was made in August 2018 with the release of Arduino IDE 1.8.6: https://github.com/arduino/Arduino/releases/tag/1.8.6

Details about the different bootloaders are described in Arduino Nano ATmega328P bootloader difference.

It seems the fuses have to be changed in order to make full use of the newer, smaller bootloader, so an ISP will have to be used anyway.

But is the bootloader able to update itself (via Tools > Burn bootloader) or is there an intermediate "bootloader update sketch" available?

1 Answer 1

2

On ATmega328p and similar ATmega MCUs with bootloader support, the application is not allowed to write to flash. Only code running in bootloader area of the flash memory is allowed to write to flash. Bootloader area is at the end of the flash and the beginning is set with the BOOTSZ fuses.

The write to flash page is done in two steps. First step is deleting the contents of the flash page, second step is write the new data to the flash page. In bootloader area* it is allowed to first prepare the data to temporary buffer page, then delete the flash and write the data in one step. So in theory the bootloader could overwrite itself with a function running in the last flash page. But I don't know about bootloader which would do it.

To write a bootloader an ISP programmer is necessary. Or other Arduino with the "Arduino as ISP" sketch.

*note: the read-while-write area at the end of flash has the size of the largest bootloader area possible and is not determined by BOOTSZ.

2
  • I think you CAN write to the bootloader from a Sketch if you can make sure the writing method is within the No-Read-While-Write section of the application flash. This is much easier when not using the Arduino IDE. (Also this is not possible if the bootloader occupies the entire NRWW section, which is not the case for OptiBoot used by Arduino.)
    – Kwasmich
    Jul 3, 2019 at 9:55
  • @Kwasmich, the boundary for SPM execution is BOOTSZ fuse
    – Juraj
    Jul 3, 2019 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.