I recently designed a custom board in KiCAD using an ATMEGA32U4, I had JLCPCB solder on the USB-C connector and MCU, however I can't get it to boot load. I referenced another design that works (I made a digital clock board about a year ago) with the same crystal, load caps, and pinout connections for ICSP.

I'm using the USBasp programmer to boot load the board, and the working clock board can still be boot loaded and programmed via USBasp and the USB C connector I have on the board.

Here is the schematic part which I am concerned about: enter image description here

Here is the full schematic for reference: https://forum.kicad.info/uploads/short-url/tlXWczVxrdgIajBN4ApMys9JN5l.pdf

Followed by screenshots of the PCB:

enter image description here

enter image description here

I have done the following:

  1. Checked voltages at probe points (3v3 at LDO, 3v3 at MCU, 3v3 at ICSP header)
  2. Checked RESET line (Initially pulled high at 3v3, when boot loading goes to 0V momentarily then goes back up to 3v3)
  3. Checked MISO, MOSI, SCK with a scope, saw nothing on all 3 lines
  4. Checked Crystal orientation, re-soldered two different crystal and load caps (tried 8pF, 10pF, and 22pF)
  5. Checked Crystal on the clock board, with just power on the board and not boot loading I see 0.8V across pins 1 and 3, on the board I have currently I see 0V.
  6. Checked for shorts or cold solder joints, could not find any or any lack of continuity.
  7. Double checked pinout, schematics are identical between the two circuits.

I am trying to bootload this board in the Arduino IDE, I set the programmer to USBasp and board to Arduino Leonardo and I get the following error:

avrdude: auto set sck period (because given equals null)

avrdude: error: program enable: target doesn't answer. 1 

avrdude: initialization failed, rc=-1

     Double check connections and try again, or use -F to override

     this check.

That leads me to two possibilites with this design:

  1. A poor layout in terms of the crystal (lack of ground plane from 3v3 trace on front copper, traces too far from MCU.
  2. Defective MCUs from JLC.

I'm sure I am missing something, but these are the only two possible solutions I could come up with. Here is also the data for the crystal: https://www.digikey.com/en/products/detail/epson/TSX-3225-16-0000MF18X-AC6/5261219.

Any help would be greatly appreciated.

  • \$\begingroup\$ "... Crystal oscillator ... load caps ..." Eh, what? Either you have a crystal with load caps, or a crystal oscillator. Please edit your question with a schematic of the circuit section that you don't think is working. While you're at it -- is there a way to "tell" the microprocessor to start up with an internal oscillator? If you can temporarily strap the thing to ignore the crystal oscillator and it still doesn't come up, then the oscillator isn't the problem. \$\endgroup\$
    – TimWescott
    Commented Feb 7 at 15:11
  • \$\begingroup\$ Right, made the changes as noted. I've seen people on forums saying there's a way to start up the board with an internal oscillator but have no idea how to change the settings in Arduino to do that. \$\endgroup\$
    – dreece2498
    Commented Feb 7 at 15:17
  • \$\begingroup\$ Chapter 29.5 in the datasheet specifies maximum clock speed vs. VCC. Using 3.3 V as VCC, a guess from the diagram, the limit is around 12 MHz. However, the MCU fuses may be set to use an external clock on XTAL1. You could connect a 1 MHz signal from a function generator to gain access to the MCU. \$\endgroup\$
    – Jens
    Commented Feb 7 at 15:30
  • \$\begingroup\$ @Jens Unfortunately I don't have a function generator, is there anyway I can use the internal crystal instead? \$\endgroup\$
    – dreece2498
    Commented Feb 7 at 15:33
  • \$\begingroup\$ There is no internal crystal, it is a R/C generator. This is the initial CLK source of the chip until you change it with a programmer, which you may have done or not. Reading 0 V at the XTAL pins let me think it is configured either to use the R/C generator or an external digital clock. You can program any Arduino to produce a 1 MHz square wave and feed this to XTAL1 via, say, 1 kohm. \$\endgroup\$
    – Jens
    Commented Feb 7 at 15:41

2 Answers 2


First thing you'll have to fix is to stitch the top-layer and bottom-layer ground planes with vias. Liberally sprinkle vias in all areas where the plane overlap. The existing layout has very poor ground quality and may well cause all sorts of issues. It doesn't mean that the issue you're facing is due to the layout, but the ground plane stitching is very poor at the moment. Low ground plane impedance is critical in making it a plane rather than a collection of polygons interconnected by slivers.

  • \$\begingroup\$ Yeah I have a very hard time establishing a ground plane for double sided layouts, single sided is much easier but I felt it would have taken away from the overall look. \$\endgroup\$
    – dreece2498
    Commented Feb 7 at 20:22

There could be many things wrong.

It is unknown if you have ordered ATmega32U4 or ATmega32U4RC. The first one has fuse bits factory set for external crystal, the latter has them set fo internal 8 MHz RC oscillator. Both include CKDIV8 fuse which divides the clock by 8, resulting into either 1 or 2 MHz depending on if it uses 8 MHz RC or 16 MHz crystal.

The operation of HWBE pin is also different with the RC version, it is disabled but with the non-RC version, it is enabled. So it might be a good idea to use a pull-up on the pin, maybe a pushbutton to ground to jump to bootloader.

The 9pF crystal loading capacitors are also smaller than recommended 12pF minimum value.

The AVR is also not rated to run at 16 MHz with 3.3V supply. It requires at least 4.5V to run at 16 MHz. So it does not have to work anyway. You could change to use 5V supply or change to a 8 MHz crystal.

Otherwise the AVR should be properly set up to 3.3V bus powered operation with external 3.3V regulator.

But another question is will the level shifter between AVR and RGB LEDs work? If you have 5V input supply, 5V LEDs, and only thing running on 3.3V is the MCU, but it requires a 5V to 3.3V regulator and level shifter from 3.3V to 5V, why not run the AVR directly at 5V, as running it at 5V makes it rated for 16 MHz operation as well. But it requires that the voltage is always above 4.5V for proper operation.

The power consumption of your device seems to be over 500mA with the LEDs on. You are only allowed to draw more than 100mA after negotiating with the PC that you need more current and are allowed to draw that amount. USB3 devices are allowed to request up to 900mA, but that is not an USB3 device so it can only request within USB2 limits up to 500mA. And if you plug it to a power supply without USB comms, you can't negotiate how much the device is allowed to draw, there is no detection mechanism for CC pins, no USB-PD communication, or no support for USB Battery Charging protocols. So basically if you don't succesfully enumerate with a PC, you can't draw more than 100mA.

The IR receiver supply is also not filtered for noise, and the LED on the data output pin is quite a strong load for the weak IR data output ping.

It is also not compliant with USB Type-C as the connector metal shell is left floating.

  • \$\begingroup\$ Might have to go back to the drawing board for this one then, from what you're saying here this design might not even be worth salvaging. \$\endgroup\$
    – dreece2498
    Commented Feb 7 at 20:22
  • \$\begingroup\$ @dreece2498 It is not hopeless but one of the things can cause it to not work. By the way, if you want to hide your full name in a PDF, you need to do it better. \$\endgroup\$
    – Justme
    Commented Feb 7 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.