Atmega328pb bootloader

I have a problem when loading the bootloader into the Atmega328PB-AN custom chip, I use an arduino nano as a programmer. When I upload the code via Arduino to Atmega328PB-an it works normally, when I connect usb to computer it connects Ch340G to computer. When I upload the bootloader in arduino ide and use MiniCore library it says it will upload but when I try to upload the code to Atmega328PB-an it throws :
avrdude warning: programmer is not responding; try -xstrict and/or vary -xdelay=100
avrdude error: unable to open programmer urclock on port COM9

schematic of my board + the error code


Core 2.0.11 and optiboot please!

I am new in this, You mean MiniCore version 2.0.11? and what is optiboot?

Using Port : COM5
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328PB
Chip Erase delay : 10500 us
PAGEL : PD7
BS2 : PC2
RESET disposition : possible i/o
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
PollIndex : 3
PollValue : 0x53
Memory Detail :

                                       Block Poll               Page                       Polled
       Memory Type Alias    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    1      0  4500  4500 0x00 0x00
       hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
       calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

Please, explain your latest post. Does that mean you were successful?

No, it starts saying:
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
....

Yes! In version core 2.0.11 bootloader is optiboot! Please reprogramm bootloader!

I use version 2.2.2 where it is also. I have uploaded the bootloader according to everything, but now it says this when I try to upload to Atmega328PB-AN:

Using Port : COM5
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328PB
Chip Erase delay : 10500 us
PAGEL : PD7
BS2 : PC2
RESET disposition : possible i/o
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
PollIndex : 3
PollValue : 0x53
Memory Detail :

                                       Block Poll               Page                       Polled
       Memory Type Alias    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    1      0  4500  4500 0x00 0x00
       hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
       signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
       calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9516 (probably m328pb)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file C:\Users\tejml\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.2.2/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex for flash
with 484 bytes in 2 sections within [0x7e00, 0x7fff]
using 4 pages and 28 pad bytes
avrdude: writing 484 bytes flash ...

Writing | ################################################## | 100% 0.08s

avrdude: 484 bytes of flash written
avrdude: verifying flash memory against C:\Users\tejml\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.2.2/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex

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

avrdude: 484 bytes of flash verified
avrdude: reading input file 0xcf for lock
with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xcf
avrdude: 1 byte of lock verified

avrdude done. Thank you.

So the problem is in the CH-340 converter

Like in the wiring or in the ch340g itself? Should I try replacing the ch340g?

It's hard to say, I would take a supporter USB-UART converter and feed it to the RX/TX pins

I didn’t see 1k resistors on the diagram between RX-CH340 and TX-328PB and similarly TX-CH340 RX-328PB? they are?

look at the RX-TX circuits in the nano diagram, do they match yours?

R6 and R7 1K ohm, I'll try replacing the ch340g and then I'll see and let you know according to what you sent I'm all good. Thank you very much for your help.

I've tried 2 things:

  1. I connected the arduino to the computer and sent data to it via serial communication ( serial monitor ) , the Rx diode flashed.
  2. I uploaded the code via Arduino Nano ( ISP ) to output the "hello" from the serial monitor, the Tx diode flashed and it output.

So I don't know where the fault is anymore, I'm wondering if it's a fault with the reset circuit (because some places have RST* over 100nF and some places have DTR* over 100nF) that the ch340g would not reset the Atmega328pb. So it couldn't bootloader there and that's why it says:

avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
........

No, it starts saying:
avrdude error: programmer is not responding
avrdude warning: attempt 1 of 10: not in sync: resp=0x00
....

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