328PB board can't upload sketch - Page 1
Forum section: electronics / general

author: AndyNZ
author_rank: Contributor
timestamp: August 23, 2024, 03:02:06 am
content: Hi allI had to adapt a custom board to fit a 328PB instead of a 88PA, and I'm having trouble uploading the sketch via ArduinoIDE. Initially I've bricked two boards (schematics attached) by burning the bootloader using the Atmega328PB 1.1.4 package, before going back to the Minicore 3.0.2 package. The bootloader burns OK with Minicore (see output below) with the 16MHz external clock set, and I can measure the 16 MHz clock signal, but when trying to upload a sketch via UART0 I get out of synch errors (see output below).I used pretty much the same setup with the predecessor board with an Atmega88PA successfully with the internal clock, so I'm fairly confident that the wiring of the ISP and UART headers is OK, I followed the schematics published on the Minicore page. I did measure the reset signal and that was OK as well. I tried all possible iterations of clock parameters, internal and external, but I can't get the sketch to upload.To burn the bootloader I'm using an Arduino Uno and the ArduinoasISP sketch, and to upload the sketch I'm using an FTDI FT232R clone.I'm still very new to this, so any suggestion on how to systematically troubleshoot this would be great.Andreas.Bootloader output:avrdude: Version 7.2-arduino.1Copyright the AVRDUDE authors;seehttps://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is C:\Users\1520004\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2\avrdude.confUsing Port : COM8Using Programmer : stk500v1Overriding Baud Rate : 19200AVR Part : ATmega328PBChip Erase delay : 10500 usPAGEL : PD7BS2 : PC2RESET disposition : possible i/oRETRY pulse : SCKSerial program mode : yesParallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0x00 0x00flash 65 10 128 0 yes 32768 128 256 4500 4500 0x00 0x00lfuse 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00efuse 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 1 0 4500 4500 0x00 0x00signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00calibration 0 0 0 0 no 1 1 0 0 0 0x00 0x00Programmer Type : STK500Description : Atmel STK500 version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard : UnknownVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsavrdude: 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 chipavrdude: processing -U flash:w:C:\Users\1520004\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2/bootloaders/urboot/atmega328pb/watchdog_1_s/autobaud/uart0_rxd0_txd1/led+b5/urboot_atmega328pb_pr_ee_ce.hex:iavrdude: reading input file C:\Users\1520004\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2/bootloaders/urboot/atmega328pb/watchdog_1_s/autobaud/uart0_rxd0_txd1/led+b5/urboot_atmega328pb_pr_ee_ce.hex for flashwith 368 bytes in 2 sections within [0x7e80, 0x7fff]using 3 pages and 16 pad bytesavrdude: writing 368 bytes flash ...Writing | ################################################## | 100% 0.08savrdude: 368 bytes of flash writtenavrdude: verifying flash memory against C:\Users\1520004\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2/bootloaders/urboot/atmega328pb/watchdog_1_s/autobaud/uart0_rxd0_txd1/led+b5/urboot_atmega328pb_pr_ee_ce.hexReading | ################################################## | 100% 0.00savrdude: 368 bytes of flash verifiedavrdude: processing -U lock:w:0xff:mavrdude: reading input file 0xff for lockwith 1 byte in 1 section within [0, 0]avrdude: writing 1 byte lock ...avrdude: 1 byte of lock writtenavrdude: verifying lock memory against 0xffavrdude: 1 byte of lock verifiedavrdude done. Thank you.programming output:avrdude: Version 7.2-arduino.1Copyright the AVRDUDE authors;seehttps://github.com/avrdudes/avrdude/blob/main/AUTHORSSystem wide configuration file is C:\Users\1520004\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2\avrdude.confUsing Port : COM9Using Programmer : urclockOverriding Baud Rate : 115200avrdude urclock_getsync() warning: attempt 1 of 10: not in syncavrdude urclock_getsync() warning: attempt 2 of 10: not in syncavrdude urclock_getsync() warning: attempt 3 of 10: not in syncavrdude urclock_getsync() warning: attempt 4 of 10: not in syncavrdude urclock_getsync() warning: attempt 5 of 10: not in syncavrdude urclock_getsync() warning: attempt 6 of 10: not in syncavrdude urclock_getsync() warning: attempt 7 of 10: not in syncavrdude urclock_getsync() warning: attempt 8 of 10: not in syncavrdude urclock_getsync() warning: attempt 9 of 10: not in syncavrdude urclock_getsync() warning: attempt 10 of 10: not in syncavrdude urclock_recv() warning: programmer is not responding; try -xstrict and/or vary -xdelay=100avrdude main() error: unable to open programmer urclock on port COM9avrdude done. Thank you.Failed uploading: uploading error: exit status 1

author: mikerj
author_rank: Super Contributor
timestamp: August 23, 2024, 10:07:29 am
content: Have you read this thread?https://forum.arduino.cc/t/minicore-atmega328-bootloader-burning-issue/1190856/31Looks like there could be some relatively tight timing constraints if you are using manual reset prior to upload.

author: bingo600
author_rank: Super Contributor
timestamp: August 23, 2024, 10:26:35 am
content: The only thing that stands out to me is that on the Nanov3 they apparently use a 1K from Reset to VCChttps://www.arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf

author: AndyNZ
author_rank: Contributor
timestamp: August 25, 2024, 09:30:56 pm
content: Thanks for your replies, I've now got it working without bootloader via direct ISP programming.I tried varying the -xdelay from -1000 to +1000 ms in 100 ms steps, which didn't help.Regarding the 10k reset resistor on UART DTR, vs the 1K on the Nano, I took the value from the Mincore Github, which worked fine with the Atmega88PA, and I also tried using a manual reset, no luck, so I don't think this is the issue.Anyway, if it works with direct ISP programming that's good enough for me.Thanks again for your help,Andreas