Code won't upload after bootloading/ICSP programming

I have a PCB I made about a year ago that was a failed project to make a digital clock with an RTC and using the Atmega32U4 as my MCU. Due to improper prototyping and incorrect pins for each segment it didn't show the time properly, however I was able to sucessfully bootload it with an ICSP header through USBasp on Arduino.

The schematic can be found here: Digital Clock.pdf | DocDroid, and the USB-C cable I'm trying to upload the code with can be found here: https://www.amazon.com/dp/B08W2129Z8?psc=1&ref=ppx_yo2ov_dt_b_product_details. The code itself was to just blink an on-board led I have connected to analog pin 5 (A5) of the Atmega, and uploads successfully when using the ICSP header via USBasp with the same COM port that I'm trying to use with the USB C cable.

The port, and board type were shown as Arduino Leonardo however anytime I tried uploading code via the USB C connector it would give the following error:

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Leonardo"

Sketch uses 3968 bytes (13%) of program storage space. Maximum is 28672 bytes.

Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.

Forcing reset using 1200bps open/close on port COM5

PORTS {COM5, } / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

PORTS {} / {} => {}

Couldn't find a Board on the selected port. Check that you have the correct port selected.  If it is correct, try pressing the board's reset button after initiating the upload.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I tried pressing and holding the reset button after pressing download but that didn't seem to fix the issue either. The track width of the Data + and Data - lines are 0.261112mm. Not sure if I used the wrong trace width or if they were routed incorrectly, I also checked that I soldered the USB-C connector, ESD protection, and MCU, and all points had continuity with a Multimeter.

Am I missing something in my schematic? Perhaps a UART IC? Wanted to reference this design for another project. Also attached are some pictures of the Arduino tool setting and the traces I routed for the D+ and D- lines.

What did you install in the above "successfully bootloaded" ? Did you install a boot loader program?

1 Like

I referenced this video process: https://www.youtube.com/watch?v=ToKerwRR-70&t=387s, but basically, I used Zadig to install a USB driver, here's a screenshot of the USBasp properties when the programmer is plugged into my computer:

image

My question is: since you said you successfully uploaded a bootloader / program via the ICSP. what program did you upload to your processor?

What you showed in post 3 is the driver for the USBasp to your PC.

1 Like
#define LED_Pin A5

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED_Pin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED_Pin, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_Pin, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

The code above is what I uploaded with the programmer set as USBasp, and by going to the Sketch menu and selecting upload using the programmer.

I figured out the issue!

When uploading with the ICSP through USBasp, according to Pert on another post:

"When you flash a sketch using ICSP, it erases the bootloader. After doing that, in order to go back to uploading over USB, you need to replace the bootloader by using the Arduino's Tools > Burn Bootloader feature."

I burned the bootloader with the ICSP, then changed the programmer and used the USB cable, held the reset button until it said uploading and then it worked!

1 Like

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