How to use 328PB as a Arduino uno?

Hi everyone,

I have some problem to get my 328PB-mu working on my project.

I bought some QFN type of 328PB-MU chips from Alibaba and I have followed the following steps: GitHub - watterott/ATmega328PB-Testing: Atmel/Microchip ATmega328PB support for Arduino IDE ;

To be more specific, after I have installed package_m328pb_index.json onto my Arduino IDE and chose the selections below to burn the bootloader. It went smoothly as I expected.
Imgur
Imgur

Then, I have tried to upload my sketch to my project board like this but it responded nothing.......

Imgur
avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0x88
avrdude.exe: ser_send(): write error: sorry no info avail
avrdude.exe: ser_recv(): read error:

Would anyone please help me. Thanks alot!

123123.png

Use MiniCore, not the older watterott core. GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB

That may not fix it, but that core is much more popular for the pb series, hence better place to get started.

Thank you very much for the reply. I have tried with Minicore library. However , it's still not responding with stk5000_recv();

I am suspicious that my board is not compatible with the 328PB. I copied the circuit of Arduino Uno. I don't know whether that could be the problem?? :o :o

Zumii_Z:
I am suspicious that my board is not compatible with the 328PB. I copied the circuit of Arduino Uno. I don't know whether that could be the problem?? :o :o

So check the pinouts in the appropriate datasheets, 328P versus 328PB, you will find a significant difference. ...........

A board built for a 328P will not be compatible with the pinout of the 328PB.

Thanks for your reply!

I checked the pinouts for 328PB. But the serial download still works with PD0(RX)PD1(TX) VCCIN and DTR. Basically, there's nothing different with code uploading circuit. The problem remains... :frowning: :frowning:

Look very close at pins 3 and 6 of the 328p-AU and 328pb-AU package (U may or may not show on the part).

ron_sutherland:
Look very close at pins 3 and 6 of the 328p-AU and 328pb-AU package (U may or may not show on the part).

Thank you for the advice. Yes, those pins have totally changed in 328PB. However, I have connected nothing with those pin 3 and 6 and only connected with what UART requires.

What board did you mount the 328pb on, was it some sort of breakout or was it done for a 328p which would have connected the pins to power and ground. Now that I said that... I wonder if floating pins could tolerate that?

Thanks, everyone. I have made great progress. I tested by change the bootloader to use its internal crystal 8M/1Mhz and my simple code was able to be uploaded. Which is Great. But when I change the bootloader to 16Mhz external, it showed "avrdude: stk500_recv(): programmer is not responding" message again.

In that case, I think the problem lies with the fuse bits. It seems like the burning bootloader process fails to change the fuse bits or somthing..

Anyone have clue about that??

Or it could be a problem with your resonator/crystal.

This board has tested with 328P. So I guess the crystal works fine.

Ok, I checked with the PDF and found the clock was default by using its 8Mhz internal crystal. And it has to do with Fuse Low Byte / CKSEL0123. Here are the capture pictures of what I have found.
Imgur
Imgur

If you switched the fuses back to use internal clock with a failed crystal that would be a neat trick. I have damaged a few crystals with a soldering iron, they do not like thermal shock.

What version of the IDE are you using?

Zumii_Z:
But the serial download still works with PD0(RX)PD1(TX) VCCIN and DTR. Basically, there's nothing different with code uploading circuit. The problem remains... :frowning: :frowning:

How does that relate to your statement in the fist post;

"Then, I have tried to upload my sketch to my project board like this but it responded nothing......".

I was actually responding to this;

But when I change the bootloader to 16Mhz external, it showed "avrdude: stk500_recv(): programmer is not responding" message again.

Check the pinouts of the 328P vs 328PB again.

Thank you for the reply. I am using 1.8.7 VERSION IDE.. and AVR board version is 1.6.23.
I found from board.txt that the fuse bit should be DE FF F4 to enable external crystal to work.
When I changed the fuse bits, the microcontroller still doesn't work.

srnet:
How does that relate to your statement in the fist post;

I was actually responding to this;

Check the pinouts of the 328P vs 328PB again.

Thank you for the help. I am using UART to upload sketches to my project board. And no matter that 328p or 328pb they are both using the same pins for uploading sketches. I seriously checked their differences but that doesn't affect the failure i think.

I found from board.txt that the fuse bit should be DE FF F4 to enable external crystal to work.
When I changed the fuse bits, the microcontroller still doesn't work.

This is what I have after burning bootloader for m328pb 16Mhz using MiniCore.

Board is a clone Nano with m328pb chip and when loaded with the bootloader it was originally supplied with, identifies as a old Nano m328p using the Arduino IDE. Using avrdude it identifies as a m328pb.

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as F5

avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as F5
avrdude: safemode: Fuses OK (E:F5, H:D6, L:FF)

Loads sketches using Minicore with no problem.

2 Likes

A board built for a 328P will not be compatible with the pinout of the 328PB.

Actually, it will probably work. Some of the pins that supplied power on the 328P are now IO pins, but as long as you don't enable them as outputs, that should be OK.

If you switched the fuses back to use internal clock with a failed crystal that would be a neat trick.

One of the improvements to the 328pb is "clock failure detection" - of the XOSC isn't working, it will switch over to the internal clock automatically. (No more bricking boards by setting the fuses wrong!)

One of the dis-improvements is the removal of the full-swing crystal oscillator, and speccing the low-power oscillator at 16MHz "maximum."

https://www.avrfreaks.net/forum/atmega328pb-frequency-instability-issues-solved

This probably means that the oscillator is more sensitive to good layout and exact specifications of the crystal and associated components. (I had some ATmega8 boards that needed "full swing" to run the 16MHz resonators that I had used.)

What could be happening is that your crystal isn't working, for one reason or another, causing the chip to revert to the internal oscillator. Of course, that's a different frequency than your crystal, so the uart is not operating at the expected speed.

Thank you WESTFW! I have changed my crystal for a test but it doesn't work. Can someone please be so kind as to post a schematic for reference? Also, what is the best parameter for fuse bits?

This is a board I did that has a 328pb, it is working, but the MCU is at 3.3V and the crystal is 12MHz.

The fuse bits I set are hear

Note: it does not have a bootloader, I just wanted a placeholder in case it made sense at some point. If you're not familiar with Makefiles, they are just a list of rules, that in this case run avrdude (and document how it was run as a side effect).