How to revert back to the default bootloader?

I'd like to switch my Nano back to Optiboot from the current Minicore bootloader (I can't recall its name). The main reason is that I'm unable to program it using the lab PCs. I attempted to re-burn it with a USBISP, but it failed because it's already using the PB bootloader. I have another Nano with a 328PB in an existing project that uses Optiboot just like a standard 328P, without needing the older bootloader, and AVRDUDESS (I think that's the program) still recognizes it as a 328PB. I want my current Nano to behave like that one. Is there another method to revert it?

Yes, read the full firmware from the nano (328PB), which behaves like a 328P, and upload it to your 328PB; the bootloader will pretend to be a 328P.

Like edit the bootloader hex file?

Does your nano have a 328P or a 328PB.

Might be easier to revert back to a version of minicore before version 3, which will burn the bootloader using Optiboot instead of Urboot.

The one I am trying to revert is a 328PB. It seems I forgot to mention it

So I would need to downgrade the library of Minicore?

Makes no sense. A USBISP should be able to burn whatever firmware / bootloader you want onto your ATMega328PB via the ICSP connection, completely irregardless of what firmware / bootloader is currently burned in it.

Did the bootloader upload fail? Or was the bootloader upload successfull, but the Nano is still not behaving correctly?

That was what I was suggesting.

The former. The Output says “Access Denied” when I try to burn the Optiboot bootloader.

I see. I was just confirming if I understood what your are suggesting

Are you sure that's not just avrdude telling you it can't access the serial port, and not the microcontroller? What's the full error message? You might be interpreting it wrongly.

"C:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cusbasp -Pusb -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:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: Warning: cannot open USB device: Function not implemented
         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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

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

avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

Hmm, now it is different. but still, there is an error

That is the error I would expect. You are trying to burn a bootloader for the 328P onto a 328PB and the signatures don't match

Okay, and what if you ignore that and change it to use -matmega328pb instead of -matmega328p? It should still be able to run the same bootloader and then report as a atmega328p.

Try to find the boards.txt in C:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6 and change

to

nano.menu.cpu.atmega328.build.mcu=atmega328pb

Then burn the bootloader once, then change it back ot its original atmega328p.

then I can just revert that change back to

nano.menu.cpu.atmega328.build.mcu=atmega328p

when I am done?

It successfully burn the bootloader with your suggestion but now…

FQBN: arduino:avr:nano
Using board 'nano' from platform in folder: C:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
C:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\janri\AppData\Local\arduino\sketches\F46B026D66DB9E9451568EA4F585582B\sketch\BlinkAndFade.ino.cpp -o nul
Generating function prototypes...
C:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\janri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\janri\AppData\Local\arduino\sketches\F46B026D66DB9E9451568EA4F585582B\sketch\BlinkAndFade.ino.cpp -o C:\Users\janri\AppData\Local\Temp\2601853937\sketch_merged.cpp
C:\Users\janri\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\janri\AppData\Local\Temp\2601853937\sketch_merged.cpp

Compiling sketch...
"C:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\eightanaloginputs" "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B\\sketch\\BlinkAndFade.ino.cpp" -o "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B\\sketch\\BlinkAndFade.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\janri\AppData\Local\arduino\cores\arduino_avr_nano_cpu_atmega328_4703b6ae7b704d79bc619c0768399005\core.a
Linking everything together...
"C:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328pb -o "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.elf" "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B\\sketch\\BlinkAndFade.ino.cpp.o" "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/..\\..\\cores\\arduino_avr_nano_cpu_atmega328_4703b6ae7b704d79bc619c0768399005\\core.a" "-LC:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B" -lm
"C:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.elf" "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.eep"
"C:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.elf" "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.hex"
"C:\\Users\\janri\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\janri\\AppData\\Local\\arduino\\sketches\\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.elf"
Sketch uses 1530 bytes (4%) of program storage space. Maximum is 30720 bytes.
Global variables use 13 bytes (0%) of dynamic memory, leaving 2035 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328pb -carduino "-PCOM10" -b115200 -D "-Uflash:w:C:\Users\janri\AppData\Local\arduino\sketches\F46B026D66DB9E9451568EA4F585582B/BlinkAndFade.ino.hex:i"

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:\Users\janri\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM10
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328PB
         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 : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega328PB is 1E 95 16
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Failed uploading: uploading error: exit status 1

It can’t accept any sketches. Did I do something wrong?

Yes exactly. Did you do that, save the file, then restarted the Arduino IDE?

That is because you now have a bootloader for the 328P burned onto a 328PB and that won't work.

The safest way to proceed is to remove your corrent version of Minicore and install version 2.2.2

No need to mess with any of the Arduino files.

The output above clearly shows that Optiboot is running on the ATMega328PB and returning the signature of ATMega328P though. So the bootloader started up fine. The problem is that it's still expecting

instead of the default atmega328p now.