Bootloader Problem Nano 328

When I upload a new bootloader
with
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
upload_protocol = usbasp
monitor_port = COM5
upload_flags = -Pusb]

and then Upload with Programmer

I can’t use the COM Port anymore
then I have to upload a Bootloader with the Arduino IDE
then I can Program with the Arduino IDE but still
PloatformIO does not program the chip with the Com Port

To program the Chip i only can use USBasp

I tried this toburn a Custom Bootloader

[env:nanoatmega328]
board = nanoatmega328

platform = atmelavr
framework = arduino
; each flag in a new line
upload_flags =
    -Pusb


upload_port = COM5

upload_protocol = usbasp

board_bootloader.file = /Bootloader/optiboot_atmega328.hex
board_bootloader.lfuse = 0xFF
board_bootloader.hfuse = 0xDE
board_bootloader.efuse = 0xFD
board_bootloader.lock_bits = 0x0F
board_bootloader.unlock_bits = 0x3F

butPlatforIO is only uploading the Program not the bootloader
and it does not care about this board_bootloader.file = /Bootloader/optiboot_atmega328.hex
Ipush the “Upload using Programing” Button

How to do this right ? What I’mmissing I

You have to use the seperate bootloader target for burning the bootloader

I.e. pio run -t bootloader

1 Like

Thanks maxgerhard took me a while because the right python path was not set.
Now the bootloader is written but I get

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x38
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x38

avrdude done.  Thank you.

I can upload now with the Arduino IDE at least

I use the bootloader optiboot_atmega328.hex
when I chance the platformIO.ini to the UNO

[env:uno]
board = uno
I can Upload to my Nano
Did I use the wrong bootloader Hex File

Sets the bootloader baud to 57600. The uno and nanoatmega328new have 115200.

Are you sure you don’t just need board = nanoatmega328new in your platformio.ini?

1 Like

As max said, since you’ve updated the bootloader, use board = nanoatmega328new so that the correct baud rate is used with the new bootloader.

And for future reference:

  • Upload -> Same as Arduino IDE Upload option, serial upload of sketch via the bootloader
  • Upload with Programmer -> Same as Arduino IDE Upload with Programmer option, uploads sketch and removes bootloader via ISCP programmer
  • pio run -t bootloader -> Same as Arduino IDE Burn Bootloader option, burns a new bootloader via ISCP programmer.

Thank you very much Max and pfeerick.
It works
but how can I get the Information

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328new 
framework = arduino

nanoatmega328new

What exactly to you mean? How to find out which bootloader is burned on the nano?

How did you know where did you find the (documentary)
of
board = nanoatmega328new

A link would be great
Thank you.

1 Like

A while later…

One of two places - the Boards Explorer (in your web browser, or via Boards in PIO Home), or via the docs - trawling the list, or searching. You’ll find two Arduino Nano ATmega328, so when one doesn’t work, you try the other, and it works! :wink: