Hey ! I'd like to design my first fully integrated PCB. I want something similar to an arduino leonardo, but with an USB-C port.
So I choosed the ATMEGA32U4-MU processor, with ABLS-16.000MHZ-B2-T crystal.
It will only work at 5V
But I am not sure about the CC1 and CC2 resistors... We don't need too much power so I choosed the 56k resistor...
Please review my schematic and feedback if you see some error before I click on the BUY button
what is USB1 ? USB Type C connector?
two LEDs up from "POWER LED" not connected;
VCC of atmega32u4 not connected, no power;
BOOT button not connected;
ENABLE pin not connected;
S1-S4 not connected;
ICSP1 pin 2 connected to it own power network?
if ADC not used then capacitor on AVCC pin 44 is not needed;
pin 2 UVcc too? idn;
D5 NC.
Thanks a lot @kolaha !
I addressed all the issues you mentioned ! Many pins not connected because it was part of a more particular project.
But now my goal is more "simple" : just make an arduino-clone with classic digital and analog I/O before moving on something more complicated.
So all the issues are addressed now if you want to check :
pinheader H6 pin A4 - NC
32u4 pin 41 ENABLE - NC
PD5 / PB0 both marked as TXLED, RXLED is PB3 on pin 11.
still S1-S4 NC
H7, H8, H10 not needed
AVCC pin 44 NC to +5V
https://www.google.com/search?q=sparkfun+micro+pro+schematic
atention, pinout is alternative
The Reset circuit looks a bit bare or maybe I've missed seeing it all.
EDIT
I see it now in the bottom right hand corner.
PD5 / PB0 both marked as TXLED, RXLED is PB3 on pin 11.
I'm not sure to understand... RXLED fixed, but for the rest...
S1-S4 fixed
H7, H8, H10 are females when the others are male, it's more handy to use i think.
AVCC pin 44 NC to +5V
Fixed. BTW All VCC are replaced by 5V now.
maybe C32 to 100µF,
usually Reset pin use capacitor too: resistor to VCC, capacitor to GND (LOW active).
Would you have some reference ? I did some research but found nothing ?
never mind?
sure haha.
I am wondering about the Crystal's capacitors : I know the rule : CX1 = 2(CL - Cstray)
X322516MOB4SI is said to be at 12pF. With a 2pF to 5pF Cstray, it gives CX1 between 14pF and 20pF.
But I found schematics with 22pF capacitors. Is the 22pF easier to source, or is there another reason for it to be choosen ?
Ok here is my final schematic.
I received the PCB this morning. I tried to flash the bootloader but without success... Here is what i did :
- I flash the AduinoISP code into an Uno.
- I connect the ISCP headers together with my board.
- I select the leonardo board in the IDE
- I choose the Arduino as ISP programmer
- I click on burn bootloader
and I get the following error :
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
Failed chip erase: uploading error: exit status 1
any idea ?
it is,
SCLK to 9
MOSI to 10
MISO to 11
RST to 13
Ok I did more attempts. Now with the verbose mode I got the following output :
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:\Users\aurel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM25
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xcb"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xcb:
avrdude: load data efuse data from input file 0xcb:
avrdude: input file 0xcb contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xd8"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd8:
avrdude: load data hfuse data from input file 0xd8:
avrdude: input file 0xd8 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude done. Thank you.
"C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\aurel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega32u4 -cstk500v1 -PCOM25 -b19200 "-Uflash:w:C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/caterina/Caterina-Micro.hex:i" -Ulock:w:0x2F:m
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:\Users\aurel\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM25
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/caterina/Caterina-Micro.hex"
avrdude: writing flash (32730 bytes):
Writing | ################################################## | 100% 57.24s
avrdude: 32730 bytes of flash written
avrdude: verifying flash memory against C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/caterina/Caterina-Micro.hex:
avrdude: load data flash data from input file C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/caterina/Caterina-Micro.hex:
avrdude: input file C:\Users\aurel\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6/bootloaders/caterina/Caterina-Micro.hex contains 32730 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 79.01s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0139
0x9c != 0x00
avrdude: verification error; content mismatch
avrdude done. Thank you.
Failed to burn bootloader: uploading error: exit status 1
I guess we can agree that the problem isn't coming from the usb-c connector ?
here is what Chatgpt thinks about it :
Based on the log you provided, it seems that the AVRDUDE is able to communicate with the ATmega32U4 microcontroller and initiate the bootloader flashing process. However, you are experiencing a verification error after the flashing process. This error occurs when the data read from the microcontroller does not match the data that was supposed to be written.
Here are some potential causes and solutions for this issue:
- Connection Issues: Ensure that the connections between your programmer and the microcontroller are secure. A loose connection can cause data to be written incorrectly.
- Power Supply: Make sure that your microcontroller is being powered correctly during the programming process. Insufficient power can cause unpredictable behavior.
- Correct Programmer: Confirm that you are using the correct programmer and protocol for the ATmega32U4. You are using
stk500v1
which should be correct for the ATmega32U4 with Arduino bootloader, but double-check the hardware setup.- Bootloader Compatibility: Make sure the bootloader you're trying to flash is compatible with the ATmega32U4 and is not corrupted.
- Clock Source: If the fuses are set incorrectly, particularly the ones that select the clock source, the microcontroller might not be running at the expected frequency. This can cause synchronization problems during programming.
Given that the error occurs at the verification stage, the last point about the clock source might be particularly relevant. If the crystal isn't properly connected or if the load capacitors do not match the crystal's requirements, the clock might not be stable, which could potentially cause the verification error. You should verify the crystal connections and ensure that the load capacitors are of the correct value as specified by the crystal's datasheet.
I replaced the 20pF capacitors with 30pF capacitors for the crystal and I succeed flashing the bootloader.
But when I plug the board through its own USB connector it's not recognized.
I have the RX and TX leds always on.
EDIT2 : i tested again the pcb with 20pF capacitors and i managed to flash the bootloader too.
I think i found the issue : i forgot the cap on ucap : the capacitor for the usb module...