I have made a custom PCB with a 328pb and decided to use MiniCore by @MCUdude. I can upload the bootloader and the program without a bootloader through ISP, but serial programming is not working as intended. If I use an FTDI adapter, programming straight up doesn´t work at all (serial monitor does work). If I use a CP2102 adapter, it only works if I reset the board at a specific time, which is hard to hit.
I suspect this is some sort of problem with the urboot bootloader and the timing of the reset through the DTR pin. Has anyone encountered and solved this issue?
This is the output while uploading:
avrdude: Version 7.2-arduino.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\HAU-NB_HLX03\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\3.0.2\avrdude.conf
Using Port : COM5
Using Programmer : urclock
Overriding Baud Rate : 115200
avrdude urclock_getsync() warning: attempt 1 of 10: not in sync
avrdude urclock_getsync() warning: attempt 2 of 10: not in sync
avrdude urclock_getsync() warning: attempt 3 of 10: not in sync
avrdude urclock_getsync() warning: attempt 4 of 10: not in sync
avrdude urclock_getsync() warning: attempt 5 of 10: not in sync
avrdude urclock_getsync() warning: attempt 6 of 10: not in sync
avrdude urclock_getsync() warning: attempt 7 of 10: not in sync
avrdude urclock_getsync() warning: attempt 8 of 10: not in sync
avrdude urclock_getsync() warning: attempt 9 of 10: not in sync
avrdude urclock_getsync() warning: attempt 10 of 10: not in sync
avrdude urclock_recv() warning: programmer is not responding; try -xstrict and/or vary -xdelay=100
avrdude main() error: unable to open programmer urclock on port COM5
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Thanks for the schematic. I was going to ask if you had the cap and pull-up on the reset pin, because that might have explained the symptoms. But what you have shown looks good. That's how I have done it previously, using CP2102. I did not have to click reset button at all to upload code like that.
Like @david_2018, it sounded like a reset circuit problem to me. But you have used the "standard" cap and pull-up, which has always worked well for me with CP2102, MiniCore, 328p 28-pin DIP.
Have you 'scoped-out the reset pin signal when you hit the upload button?
Just want to verify that you did not upload a sketch via ISP, that will erase the bootloader. Does not seem to be the case here, since you can upload by manually resetting.
Some things that have helped me with serial programming a stand alone 328PB. Make sure the variant "328PB" is selected (though that normally gives a device sig error if it isn't selected), make sure you are using the MiniCore 328 board. Close out of all serial monitor sessions in the IDE and from terminal emulators if you are using one (this is a big one, open serial monitor sessions will give the error you see).
Check for solder bridges anywhere on the 328 chip. I have run into issues a few times from this. I solder my chips using solder paste and a heat bed along with hot air, it took me awhile to get a good process down to where I wasn't created bridges all the time. Now it only happens occasionally, but it will stop the serial programming in its tracks.
I use the DSD Tech FTDI 232 USB Serial TTL, Tx -> Tx, Rx -> Rx, RST -> reset through a 100nF cap (which looks like you have). I have also used Uno R3s as a USB Serial adapter. Take out the 328P chip and connect with Tx, Rx, RST, Gnd, and 5V.
The datasheet of the 328pb mentiones a lower reset threshold voltage of 0.2*Vcc (so 1V for 5V Vcc). However it seems like the reset pin only goes down to 1.78V. Could this be my problem? Do I need a larger pullup resistor and/or smaller cap?
So the solution to my problem is to either use a 3.3V serial programmer, or with a 5V programmer use a protection diode on the reset pin to prevent the 328pb from enetring HV programming mode (which it apperantly did).