How to configure Arduino R3 ATMEGA328PB

Hi, guys.

I bought this dude here: https://s.click.aliexpress.com/e/_DD0TYk9
but I have so many troubles trying to connect and upload code (even burn the bootloader)

So, have anyone here purchased the same board to share how to configure and upload code to it?

For 328PBs, I've had good luck with the 328PB variant in the MiniCore core. I started with a bare chip that I put on a carrier board, burned a UART0 bootloader, hooked up an FT232 board and it programs the same as an ordinary Uno, only with more peripherals to choose from.

Edit: and thanks to @sterretje for catching my initial boneheaded mistake!

I'm a little confused why you would use the "328P / 328PA" for a 328PB? But I have no personal experience with the 328PB.

1 Like

Well, that's embarrassing. I meant to write the 328PB variant. Obviously my brain was disconnected from my hands at that moment. Thanks for catching that one!

That's the point. I searched the internet and in most cases people used another board or built a system to burn the bootloader.
I thought the board was supposed to be "plug and play"...

PS: yes, I'm a noob

And what leads you to believe that there isn't a bootloader already on the board?

I can't load and run the compiled code.

I'm going to ask you to provide some additional information that might help us to identify the problem.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. When you encounter this mysterious "can't load and run" problem, there should be an error notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  2. Open a forum reply here by clicking the "Reply" button.
  3. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  4. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the copied output into the code block.
  5. Move the cursor outside of the code block before you add any additional text to your reply.
  6. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.

Click here for attachment instructions

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:

    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Sketch uses 1450 bytes (4%) of program storage space. Maximum is 32384 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2037 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1/bin/avrdude" "-CC:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1/etc/avrdude.conf" -v -V -patmega328pb -cstk500v1 -PCOM3 -b19200 "-Ueeprom:w:C:\Users\Daniel\AppData\Local\arduino\sketches\281D9E731FBA818F77C28F30E4718B79/sketch_dec11a.ino.eep:i" "-Uflash:w:C:\Users\Daniel\AppData\Local\arduino\sketches\281D9E731FBA818F77C28F30E4718B79/sketch_dec11a.ino.hex:i"
Avrdude version 8.0-arduino.1
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is C:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1\etc\avrdude.conf

Using port            : COM3
Using programmer      : stk500v1
Setting baud rate     : 19200
Error: programmer is not responding
Warning: attempt 1 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 2 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 3 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 4 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 5 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 6 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 7 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 8 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 9 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 10 of 10: not in sync: resp=0x00
Error: unable to open port COM3 for programmer stk500v1

Avrdude done.  Thank you.
Failed programming: uploading error: exit status 1

I see you are either attempting a "Burn Bootloader" or an "Upload Using Programmer" operation. That should not be necessary, and even if it were necessary you would need a spare board to use as the programmer, which I'm guessing you don't have.

So for now let's see if we can solve whatever mysterious problem you might have been having before you went down the "Burn Bootloader" rabbit hole.

I'm going to ask you to provide the full verbose output from an upload attempt.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Uncheck the box next to Show verbose output during: compile in the "Preferences" dialog.
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the "OK" button.
    The "Preferences" dialog will close.
  5. Select Sketch > Upload from the Arduino IDE menus.
  6. Wait for the upload to fail.
  7. You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  8. Open a forum reply here by clicking the "Reply" button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to post the output.
Sketch uses 1450 bytes (4%) of program storage space. Maximum is 32384 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2037 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1/bin/avrdude" "-CC:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1/etc/avrdude.conf" -v -V -patmega328pb -curclock -PCOM3 -b115200 -D -xnometadata "-Ueeprom:w:C:\Users\Daniel\AppData\Local\arduino\sketches\281D9E731FBA818F77C28F30E4718B79/sketch_dec11a.ino.eep:i" "-Uflash:w:C:\Users\Daniel\AppData\Local\arduino\sketches\281D9E731FBA818F77C28F30E4718B79/sketch_dec11a.ino.hex:i"
Avrdude version 8.0-arduino.1
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is C:\Users\Daniel\AppData\Local\Arduino15\packages\MiniCore\tools\avrdude\8.0-arduino.1\etc\avrdude.conf

Using port            : COM3
Using programmer      : urclock
Setting baud rate     : 115200
AVR part              : ATmega328PB
Programming modes     : SPM, ISP, HVPP, debugWIRE
Programmer type       : Urclock
Description           : Urboot bootloaders using urprotocol
Protocol              : STK500v1 skeleton

AVR device initialized and ready to accept instructions
Error: connected part ATmega328P signature does not match -p ATmega328PB's (override with -F or use -p ATmega328P)
Error: unable to read signature data for part ATmega328PB (rc = -1)
Error: unable to read signature data (rc = -1)
use -F to override this check

Avrdude done.  Thank you.
Failed uploading: uploading error: exit status 1

Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus and then try uploading again. Hopefully it will be successful this time.

1 Like
Sketch uses 1176 bytes (3%) of program storage space. Maximum is 32256 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2037 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\Daniel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\Daniel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM3" -b115200 -D "-Uflash:w:C:\Users\Daniel\AppData\Local\arduino\sketches\281D9E731FBA818F77C28F30E4718B79/sketch_dec11a.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\Daniel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         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 : 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 | 
avrdude: arduino_read_sig_bytes(): (a) protocol error, expect=0x10, resp=0xfc
avrdude: error reading signature data for part "ATmega328P", rc=-3
avrdude: error reading signature data, rc=-3

avrdude done.  Thank you.

Failed uploading: uploading error: exit status 1

After the last error, I just had to reselect the COM3 port on IDE and now it's working!

Thank you for the patience.

Great news! Thanks for taking the time to post an update.

Regards, Per

@ptillisch - I'm adding to this older thread specifically because it's extremely pertinent. If you'd rather, make my post a new topic, and then I'll edit it with more background for clarity.

I purchased 10 "Arduino Nanos with USB Mini" from AliExpress in March 2025. When they arrived, I noted they actually had ATMEGA328PB marked MCUs, but I had to press on with the project at hand so I set them aside. Today, I needed another Nano, and thought I'd try one of these.
Note - I already have the CH340 USB driver loaded, as I use it all the time for my Nano clones.
When I plugged in the device, it emitted seven or eight double-blink flashes, then went to the typical 1hz blink of Blink.ino. Never seen the double-blink series before, but, meh.
So I opened up Blink.ino and changed the on and off times so I could identify unequivocally that the device had received a new version, then clicked on "Upload".
This new board programs exactly as if it was an ATMEGA328PA-based Nano, using the Nano board and the new Bootloader in the IDE(1.8.19). The MCU's signature is consistent, being 0x1e950f, not the 0x1e9516 that is expected for an ATMEGA328PB.
Either these '328PB' chips are really plain old '328A' under the hood, OR, they've spoofed the signature (via the bootloader?) so the device appears to be a '328A'. The latter I would find harder to believe than a simple labeling change, though either would be extremely deceitful. Don't suppose it matters much, as long as all you want is the functionality of a '328A.

So, for those buying these devices, once you have the CH340 driver loaded, your first step probably should be to try to program 'Blink.ino' using the Nano board and the 'new' bootloader.

0x1e950f is the signature of the ATmega328P and ATmega328PA. The signature of the ATmega328A is 0x1e9514.

The Optiboot bootloader just returns the signature that was defined in the bootloader program rather than actually reading the signature from the chip:

https://github.com/Optiboot/optiboot/issues/184#issuecomment-230144696

the optiboot bootloader returns a signature that is hard-coded in the bootloader, rather than the actual signature of the chip. ie - the bootloader lies

So it is trivial to cause the board to identify itself as an ATmega328P

1 Like

Then the only conclusion I see as reasonable is that the device label is incorrect, whether deliberate or otherwise.
Thank you.

The 328PB is backwards-compatible enough with the 328P that you can substitute a (cheaper) 328PB and run 328P firmware on it without any problems. The PB has extra IO pins (A6 and A7 become digital-capable, and some of the power pins become IO), an extra UART, and extra I2C and SPI peripheral, two extra times. But none of that will come into play if you don't try to turn them on.

Even the hardware is sort-of pin-compatible (you end up connecting Vcc to an pin of the PB that is GPIO, but since it defaults to input and 328P software won't set it otherwise, that doesn't actually cause problems.)

Also, the 328P is "Not Recommended for new designs" (but the 328PB is not available in DIP :frowning: )

1 Like

Right. So as I read this, they could actually be '328PB' devices. The board is clearly a typical Nano clone, as MCU pin 3 is shorted to GND, and pin 6 is shorted to VCC; however, a 328PB will work just fine as long as one makes no attempt to make those pins outputs; if it's a 328PB, all other features should work.

And sure enough, using ArduinoISP on an Uno I can program the device with the Minicore bootloader with a 328PB as target; the device identifies with the correct 328PB ID. I can then download a variant of blink.ino with initialization of both Serial and Serial1.

Excellent. Hopefully, the above addition to this thread is useful for someone else down the road.