So I built my own Arduino PCB based on the Nano.
It has a few extra components on for 7 segment displays, wireless header and a few buttons.
Issue I am having is that I run the board for a few days and then when I try to upload a new sketch, it won't let me.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x33
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
I have to reflash the bootloader to get it to work.
Is the "run the board for a few days" part required to reproduce the problem, or does the same failure occur if you try to upload twice immediately after burning the bootloader?
pert:
Is the “run the board for a few days” part required to reproduce the problem, or does the same failure occur if you try to upload twice immediately after burning the bootloader?
Just tested uploading right after the first upload and it fails.
Sketch uses 14696 bytes (47%) of program storage space. Maximum is 30720 bytes.
Global variables use 1041 bytes (50%) of dynamic memory, leaving 1007 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b57600 -D -Uflash:w:C:\Users\Jack\AppData\Local\Temp\arduino_build_895768/distance_meterMay.ino.hex:i
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: ser_drain(): read error: The I/O operation has been aborted because of either a thread exit or an application request.
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_drain(): read error: Access is denied.
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_drain(): read error: Access is denied.
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3b
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: Access is denied.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3b
avrdude: ser_drain(): read error: Access is denied.
avrdude done. Thank you.
the selected serial port
does not exist or your board is not connected
processing.app.SerialException: Error opening serial port 'COM5'.
at processing.app.Serial.<init>(Serial.java:147)
at processing.app.Serial.<init>(Serial.java:82)
at processing.app.SerialMonitor$2.<init>(SerialMonitor.java:131)
at processing.app.SerialMonitor.open(SerialMonitor.java:131)
at processing.app.AbstractMonitor.resume(AbstractMonitor.java:134)
at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2135)
at processing.app.Editor.access$1300(Editor.java:117)
at processing.app.Editor$UploadHandler.run(Editor.java:2109)
at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM5; Method name - openPort(); Exception type - Port not found.
at jssc.SerialPort.openPort(SerialPort.java:167)
at processing.app.Serial.<init>(Serial.java:136)
... 8 more
Error opening serial port 'COM5'.
Usually the "can only upload once" symptom is caused by a missing auto-reset circuit. In order to upload, the bootloader must be activated. This is done by resetting the microcontroller at just the right time during the upload process. The Arduino Nano and the other Arduino boards with a dedicated USB to serial adapter chip have a special circuit that allows the IDE to automatically reset the board. If your board is missing this circuit (DTR or RTS pin of the USB to serial chip connected to the ATmega328P's reset pin) then the IDE won't be able to reset the board.
The reason the auto reset isn't required on the first upload after burning the bootloader is because the bootloader continues to run constantly after doing that.
You can test this by manually resetting the board. When you don't have that auto-reset, and are resetting manually, you need to get the timing right. If you press the reset button too early, the bootloader will have already timed out by the time the upload starts. The tricky thing is that when you press the "Upload" button in the Arduino IDE, it first compiles your sketch before starting the actual upload. So you need to wait until after the compilation finishes before pressing the reset button. The way to get the timing right is to watch the black console window at the bottom of the Arduino IDE window. As soon as you see something like this:
Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
press and release the reset button. The upload should now finish successfully.
pert:
Usually the "can only upload once" symptom is caused by a missing auto-reset circuit. In order to upload, the bootloader must be activated. This is done by resetting the microcontroller at just the right time during the upload process. The Arduino Nano and the other Arduino boards with a dedicated USB to serial adapter chip have a special circuit that allows the IDE to automatically reset the board. If your board is missing this circuit (DTR or RTS pin of the USB to serial chip connected to the ATmega328P's reset pin) then the IDE won't be able to reset the board.
The reason the auto reset isn't required on the first upload after burning the bootloader is because the bootloader continues to run constantly after doing that.
You can test this by manually resetting the board. When you don't have that auto-reset, and are resetting manually, you need to get the timing right. If you press the reset button too early, the bootloader will have already timed out by the time the upload starts. The tricky thing is that when you press the "Upload" button in the Arduino IDE, it first compiles your sketch before starting the actual upload. So you need to wait until after the compilation finishes before pressing the reset button. The way to get the timing right is to watch the black console window at the bottom of the Arduino IDE window. As soon as you see something like this:
Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
press and release the reset button. The upload should now finish successfully.
I have a reset pin from the FTDI USB to Serial IC.
pert:
DTR or RTS pin of the USB to serial chip connected to the ATmega328P's reset pin
I see from your schematic that you already know, but just to correct myself, I left off a very important part in this part of my last reply: via a 0.1 uF capacitor.