Including the ATmega328PB as a further Nano variant

Why is there no official support for the ATmega328PB in the Arduino IDE? The processor is a typical AVR!
There are several packages (Pololu, Watterot, MiniCore, ...) with which the IDE is actually unnecessarily inflated!
I have a Nano clone with the ATmega328PB from China, it works as a "normal" Nano, but without being able to use its extended functions.

Do 'Arduino' make any boards that use the ATmega328PB ?

Good question! I remember a wish to replace the 328P with the newer 328 PB. This could give the "old" Nano another push.

There are at least three 328PB cores

All companies sell 328PB Arduino compatible boards, The AVR one is cheap (if available)

Don't forget the best of all (already mentioned in passing by @RudolfAtRTC):

it is simple to use a custom board with existing official boards package:
https://arduino.stackexchange.com/questions/54484/adding-a-custom-board-to-the-arduino-ide/

My experiance with MiniCore: It compiles, but the upload fails with all offered Programmer variants

In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to post the full output from the upload when in verbose mode.

Please do this:

  1. Select File > Preferences from the Arduino IDE's menus.
  2. Uncheck the checkbox next to Show verbose output during: [] compilation
  3. Check the checkbox next to Show verbose output during: [] upload.
  4. Click the OK button.
  5. Attempt an upload, as you did before.
  6. After the upload fails, copy the full text of the black console pane at the bottom of the Arduino IDE window and paste it in reply here.

To in0: A little late answer. I've done this many times. The output doesn't help me. I hope you see something ...

This is the full output from Arduino IDE 2.0.0 RC:

*Using board '328' from platform in folder: C:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3*
*Using core 'MCUdude_corefiles' from platform in folder: C:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3*
*Detecting libraries used...*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\pb-variant" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp" -o nul*
*Alternatives for FileProperties.h: [FileProperties]*
*ResolveLibrary(FileProperties.h)*
*  -> candidates: [FileProperties]*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\pb-variant" "-Id:\\Arduino\\libraries\\FileProperties" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp" -o nul*
*Alternatives for LEDWrapper.h: [LEDWrapper]*
*ResolveLibrary(LEDWrapper.h)*
*  -> candidates: [LEDWrapper]*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\pb-variant" "-Id:\\Arduino\\libraries\\FileProperties" "-Id:\\Arduino\\libraries\\LEDWrapper" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp" -o nul*
*Using cached library dependencies for file: d:\Arduino\libraries\FileProperties\FileProperties.cpp*
*Using cached library dependencies for file: d:\Arduino\libraries\LEDWrapper\LEDWrapper.cpp*
*Generating function prototypes...*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\pb-variant" "-Id:\\Arduino\\libraries\\FileProperties" "-Id:\\Arduino\\libraries\\LEDWrapper" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp" -o "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\preproc\\ctags_target_for_gcc_minus_e.cpp"*
*"C:\\Users\\Rudol\\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\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\preproc\\ctags_target_for_gcc_minus_e.cpp"*
*Compiling sketch...*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328pb -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_ATmega328 -DARDUINO_ARCH_AVR "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\MiniCore\\hardware\\avr\\2.1.3\\variants\\pb-variant" "-Id:\\Arduino\\libraries\\FileProperties" "-Id:\\Arduino\\libraries\\LEDWrapper" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp" -o "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp.o"*
*Compiling libraries...*
*Compiling library "FileProperties"*
*Using previously compiled file: C:\Users\Rudol\AppData\Local\Temp\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\libraries\FileProperties\FileProperties.cpp.o*
*Compiling library "LEDWrapper"*
*Using previously compiled file: C:\Users\Rudol\AppData\Local\Temp\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\libraries\LEDWrapper\LEDWrapper.cpp.o*
*Compiling core...*
*Using precompiled core: C:\Users\Rudol\AppData\Local\Temp\arduino-core-cache\core_bf8e19ac29e478b82e90056febb52153.a*
*Linking everything together...*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -Wl,--gc-sections -mmcu=atmega328pb -o "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.elf" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\sketch\\ReadSignature.ino.cpp.o" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\libraries\\FileProperties\\FileProperties.cpp.o" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD\\libraries\\LEDWrapper\\LEDWrapper.cpp.o" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/..\\arduino-core-cache\\core_bf8e19ac29e478b82e90056febb52153.a" "-LC:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD" -lm*
*"C:\\Users\\Rudol\\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\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.elf" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.eep"*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.elf" "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.hex"*
*cmd /C "C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objdump" --disassemble --source --line-numbers --demangle --section=.text "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.elf" > "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino_atmega328pb_16000000L.lst"*
*Using library FileProperties in folder: D:\Arduino\libraries\FileProperties (legacy)*
*Using library LEDWrapper in folder: D:\Arduino\libraries\LEDWrapper (legacy)*
*"C:\\Users\\Rudol\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Rudol\\AppData\\Local\\Temp\\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.elf"*
*Sketch uses 5486 bytes (17%) of program storage space. Maximum is 32256 bytes.*
*Global variables use 533 bytes (26%) of dynamic memory, leaving 1515 bytes for local variables. Maximum is 2048 bytes.*

*--------------------------*
*Compilation complete.*
*"C:\Users\Rudol\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude" "-CC:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf" -v  -patmega328pb -carduino -PCOM3 -b115200 -D "-Uflash:w:C:\Users\Rudol\AppData\Local\Temp\arduino-sketch-97050FF78089F6E83E848D928F4AACAD/ReadSignature.ino.hex:i"*

*avrdude: Version 6.3-20201216*
*         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/*
*         Copyright (c) 2007-2014 Joerg Wunsch*

*         System wide configuration file is "C:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"*

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

*avrdude done.  Thank you.*

*Upload error: Failed uploading: uploading error: exit status 1*

Compiling with the "old" IDE type 1.8.16 gives almost the same result, only the "resp" of avrdude is different.

Sketch uses 5486 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 533 bytes (26%) of dynamic memory, leaving 1515 bytes for local variables. Maximum is 2048 bytes.
C:\Users\Rudol\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf -v -V -patmega328pb -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Rudol\AppData\Local\Temp\arduino_build_879656/ReadSignature.ino.hex:i 

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"

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

avrdude done.  Thank you.

Problem uploading to board.  See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.

Reference:

ATmega328PB is not a drop-in replacement for ATmega328 variants, but a new device. However, the functions are backward compatible with the existing ATmega328 functions. Existing code for these devices will work in the new devices without changing existing configuration or enabling new functions.

In a world where there are ample 8-bit microcontrollers, I can understand why Arduino does not produce a -328PM model; there is unlikely market drivers to make such a board a profit for Arduino who is constantly in competition with clone manufactory. Perhaps a re-spin of the UNO formfactor due to a large commercial purchase (school, colleges, etc.) would provide a break-even opportunity.

SOAPBOX OPINION:
I read numerous forum posts and a very large numbed of posters are using clones primarily because they are less costly. Of course they are, they are copies or near replicas. Some companies do produce original "compatible" products BUT do they provide a costly forum to discuss problems and issues? Hosting is not free and with increase scrutiny on energy consumption due to global warming, electrical & cooling costs are going to increase.

Hobbyist have always been cost-conscious and prone to buy discounted in order to play at the hobby. Everyone understands to a degree buying clones - but, may I suggest that all design efforts and published/public projects use an Original Arduino. When it comes to replicating a working template for friends and family, cheap clones are inevitably prudent. Your initial purchase of all models of interest from Arduino will provide two important components:

  1. Increase sales by Arduino to defer operating costs;
  2. Focus on issues in these forums to concern regarding "real" hardware and not issues from 3rd party clone sloppiness or lack of Quality Assurance.

Regards,
Ray

1 Like

This is the revenge of "open source"!

Again at In0; After a small change in the "boards.txt" file, the feedback from the upload was completely different.
The change (speed from 115200 to 57600):

328.menu.clock.20MHz_external=External 20 MHz
328.menu.clock.20MHz_external.upload.speed=57600
#328.menu.clock.20MHz_external.upload.speed=115200

Very strange: avrdude sees "0x1e950f" as the signature, every sketch "readsignature.ino" shows "Your AVR signature is 1E 95 16". Who is right now?
The display of the upload:

Sketch uses 5450 bytes (16%) of program storage space. Maximum is 32256 bytes.
Global variables use 526 bytes (25%) of dynamic memory, leaving 1522 bytes for local variables. Maximum is 2048 bytes.
C:\Users\Rudol\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf -v -V -patmega328pb -carduino -PCOM3 -b57600 -D -Uflash:w:C:\Users\Rudol\AppData\Local\Temp\arduino_build_402180/ReadSignature.ino.hex:i 

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Rudol\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         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
           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
           efuse          0     0     0    0 no          1    0      0  4500  4500 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

An error occurred while uploading the sketch
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.

Have you burned the MiniCore bootloader to the atmega328PB? The original (old) Nano bootloader used 57600 baud.

1 Like

to david_2018: That was exactly the right question. I've finally burned the bootloader and everything works. Thank you!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.