How to program an ATmega328PB-MU with an UNO board

Hi everyone,

I'm trying to develop a new board using an ATmega328PB-MU. I tried MiniCore to burn the bootloader (and many others ...) with an arduino UNO connected to it through ICSP pin header and it worked just fine.
My problem occur when I'm trying to upload a sketch from serial . If I try to upload a sketch right after I burn the bootloader it program the ATmega328PB through serial but the code seems to be "randomly executed". But if I wait 30s before programming it through serial I get this error :
avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xc1

I tried many different bootloaders and I get the same result with all of them ...

The ATmega328PB is connected to a +5V rail and clocked with a ceramic resonator at 16MHz. My serial programmer is directly on the board. It's composed of an FT230XQ.
I'm using Arduino IDE 1.8.15 and MiniCore 2.1.2.
I have other boards added. Could this interfere with MiniCore ? (I don't think so tbh)

I linked the schematic...

If someone has any idea ?

Thanks !!

Isn't the reset circuit incomplete?
There are no series capacitors and the signal should use DTR instead of RTS.
See the image of the minimal setup at the bottom of below git.
https://github.com/MCUdude/MiniCore#minimal-setup

Also, since the 328PB has two hardware UARTs, did you choose the correct one to burn the bootloader?

DTR should be connected to reset through a 0.1uF cap. The usual pull-up on reset is 10K, 1K may be too strong.

What does the choice of serial port have to do with burning a bootloader?

Not the serial port at the use to burn bootloader.
It is because the hardware UARTs that the MiniCore bootloader at 328PB listens to when waiting for programming is hard-coded to select when burning.
Can choose either one to suit your PCB design.
He uses PD0 and PD1 (UART0), so you have to choose that.
MiniCoreSetting


EDIT:
I'm sorry to the my IDE is Japanese language.
But the necessary part has English.

I see, Thanks for the explanation. I have only experience with the DIP 328 so never saw that.

Hi,
I do have a ceramic capacitor of .1uF between DTR and reset pin. It didn't upload FT230XQ schematic since I'm a new member I could upload just one picture at a time.

I selected UART0 and wired it to UART0.

I'm sure since it work, several minutes after I burned the boot loader but at a time it stops working.

I don't know if it's clear.

Let me know ! But thanks for your help !

To be sure that I didn't miss something !
This is my serial uploader schematic !

FT230XQ

TXD & RXD are wired correctly and the chip is working (loop test successfull).

Julien.

Hi!
Just tried with an another programmer (an another UNO board, I bought an Atmel programmer yesterday to try, but I didn't receive it yet). Got same results, after I've burned the bootloader PB5's led flash twice every second. It also flash when I reset the board. But I guess I find the problem (not the solution yet ...)

I did some measurement with my oscilloscope and the USB to serial chip toggles RST pin correctly (this is what I was guessing since the scope are correct for 328 version). And if I upload the code with the serial chip but I toggle the reset by hardware it works just fine. Same when I programmed a serial loop test on the MCU.

So now I know that's my RST system that doesn't work ... I don't even know why since I'm using a 10k resistor with a 100nF cap ... and used this chip with this system a hundred times but with ATmega328P. Is an incompatibility possible, isn't it ?

I got this, it fells below 2.7V but it seems not enough to toggle reset pin.

I firstly thought to replace the 10k R5 resistor with 100k one. It doesn't solve the problem even by pulling down the reset to reach 1.8V.

To have a standard, there is the reset pin voltage toggled with software (One the arduino UNO RST pin is toggled down by an ATmega8u2 through a 100n cap). It toggles the pin below 0.7V

And I found out why ... There is an incompatibility ... The ATmega328, 328P and 328PB version doesn't has the same reset threshold (according to this guy and the datasheet)... to use an FTDI 230XQ chip we should (didn't test yet) use a transistor to tied RST pin below 1.6V.

I'll try to find a solution to fix my FT230XQ and post it here.

Thanks for your help !

2 Likes

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