Burn Booloader on a Nano 328PB

Hello,

I have been trying for days to Burn a Bootloader in NANO equipped with a ATmega328PB, not the (328P), like most of the chinese clones use.

The Arduino IDE detects a CPU signature that is different than the usual 328P signature, and consequently the well know methos based on “Arduino as ISP,” + Burn booloader" does ot work.

Do you know if PlatformIO has a board definition for the 328PB in order to burn a bootloader from PlatformIO ?

Thank you,

Well which one?

Per Atmel AVR — PlatformIO latest documentation you can see which avrdude protocol and speed the Arduino as ISP upload method uses.

So when I create a new blank project for the “Nano Atmega328” and modify the platformio.ini to

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
board_build.mcu = atmega328pb
; CHANGE COM PORT AS NEEDED
upload_port = COM10
upload_speed = 19200
upload_flags =
    -P
    $UPLOAD_PORT
    -b
    $UPLOAD_SPEED
upload_protocol = stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

And open a PlatformIO CLI to trigger

> pio run -t bootloader -v

It seems to want to do the right thing with setting the fses first.

Using bootloader image:
/home/max/.platformio/packages/framework-arduino-avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

Selected fuses: [lfuse = 0xFF, hfuse = 0xDA, efuse = 0xFD]
avrdude -p atmega328pb -C "/home/max/.platformio/packages/tool-avrdude/avrdude.conf" -e -c stk500v1 -P COM10 -b 19200 -Ulock:w:0x3F:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m -Uefuse:w:0xFD:m
avrdude: ser_open(): can't open device "COM10": No such file or directory

avrdude done.  Thank you.

*** [bootloader] Error 1

since I don’t have a programmer attached that fails. But if it succeeds, it should write the bootloader image next.

Thank you maxgerhardt .
None of the methods (your Github links, including Minicore), work for me, the worst being Minicore that has generated a complete a major problem with the Arduino IDE: it became impossible to upload any program (!). So I have uninstalled Minicore, and everything get back perfect.

The PlatformIO approach looks a bit complex for me (but it should work) compared with the simple procedure to burn a Bootloader into a classic 328P (the “Arduino as ISP” is very very simple)…I still believe that someone should create a “simple” procedure like it exists for the 328P, and if I had the knowledge I will do it !

I have finally decided to take care to the NANO I buy, and check that they are equipped with a 328P (and not 328PB) prior purchase: this save me a lot of time !

It is also possible that my NANO 328PB has a failure (?), but 3€ is not a big deal, so I put it into a bin and work only with 328P therefore…

Thank you very much