SafeASP - Wiring by section

USB-C AVR ISP programmer · ATmega8A + USBasp firmware · 1.8-5.5 V level shifting · Sheet N here = Sheet N on every page

Design stage. Planned design, not a finished schematic or PCB and not built yet: nets come from tools/data.py, pin numbers of U1, U4, U5 were read from the datasheets, but every symbol and footprint must still be checked in EasyEDA.

5 V / VBUS3.3 Vtarget supply (VTGT)GNDUSBISP, 5 V side (_M)ISP, target side (_T)BUSY_N / OE#MCU control

System wiring (connection map)

USB-C (J1)R1 / R2 5.1 k on CC1 / CC2U2 USBLC6 ESD on D+ / D-F1 PTC 500 mA -> +5VC1 10 uF, C2 100 nFV-USB INTERFACER3 / R4 68 R seriesD1 / D2 3.6 V zener clampsR5 2.2 k D- pull-uplow-speed USB 1.1ATMEGA8A + USBasp FIRMWAREU1 ATmega8A-AU, 5 V, Y1 12 MHzPB0 = D-, PB1 + PD2/INT0 = D+PB3 MOSI, PB4 MISO, PB5 SCKPB2 = target RSTPC1 = red LED + BUSY_N (OE#)PC0 = green LED (USB ready)PC2 = JP2 slow SCKJ4 = flash this chipfirmware: USBasp 2011-05-28,unchanged (same pins)LEVEL SHIFTERU4 74LVC8T245: MOSI, SCK, RST out A side 5 V, B side = VTGT OE# = BUSY_N: Hi-Z when idleU5 74LVC1T45: MISO in (B to A)R10 OE# pull-up, R11-13 pull-downsworks for 1.8 to 5.5 V targetsTARGET POWERU3 AP2112K 3.3 V LDOJP1: 5 V / 3.3 V / offF2 PTC 200 mA -> VTGTLED3 yellow = we power the targetISP OUTJ2 10-pin boxJ3 6-pinMOSI_TSCK_TRST_TMISO_TVTGT (pin 2)GNDD+ D-USB_DP/DN+5V_M netsBUSY_N_T netsVTGTVTGT+5V

Pin assignment (ATmega8A, TQFP-32 pin numbers)

PinNetGoes to
PB0 (12)USB_DND- via R4, D2; R5 pull-up
PB1 (13), PD2/INT0 (32)USB_DPD+ via R3, D1
PB2 (14)RST_MU4 A3 -> RST_T
PB3 (15)MOSI_MU4 A1 -> MOSI_T; J4 pin 4
PB4 (16)MISO_MU5 A <- MISO_T; J4 pin 1
PB5 (17)SCK_MU4 A2 -> SCK_T; J4 pin 3
PC0 (23)LED_G_KLED2 green (low = on)
PC1 (24)BUSY_NLED1 red + U4 OE# (low while programming)
PC2 (25)SLOW_SCKJP2 to GND
PC6 RESET (29)MCU_RSTR6 10 k, J4 pin 5
PB6 / PB7 (7 / 8)XTAL1 / XTAL2Y1 12 MHz, C3 / C4 22 pF

These are exactly the pins the USBasp 2011-05-28 firmware uses (usbasp.h: red LED PC1, green PC0; isp.h: RST PB2, MOSI PB3, MISO PB4, SCK PB5; usbconfig.h: D- PB0, D+ PB1; main.c: slow SCK on PC2 with pull-up). No firmware change is needed.

External wiring (what you connect by hand)

ConnectionHow
USB-C (J1)Any USB-C cable to a PC: USB-C to USB-C works too, because CC1 and CC2 each have their own 5.1 k pull-down. The board draws about 20 mA plus the target.
10-pin ISP (J2)Standard AVR 10-pin ribbon: 1 MOSI, 2 VCC, 3 NC, 4/6/8/10 GND, 5 RST, 7 SCK, 9 MISO. The box header key stops a reversed plug.
6-pin ISP (J3)Standard AVR 6-pin (Arduino ICSP): 1 MISO, 2 VCC, 3 SCK, 4 MOSI, 5 RST, 6 GND. Use J2 OR J3, not both at once.
Target supply (JP1)Jumper 1-2 = we send 5 V, 2-3 = we send 3.3 V, none = the target has its own supply. The level shifter always follows the voltage on ISP pin 2, so the target pin 2 MUST have power (ours or its own) or the outputs stay off.
NeverNever fit JP1 when the target has its own supply (two supplies fighting). Never feed more than 5.5 V on ISP pin 2.
Slow SCK (JP2)Fit for a target running below 1.5 MHz (for example a new ATmega with CKDIV8 on 1 MHz internal clock), or use avrdude -B 32.
Self-programming (J4)Only to flash the ATmega8A of this board with another programmer. Unplug USB-C first; the other programmer supplies 5 V on pin 2.

Pin-to-net per section: each box is a part; the flag on a pin is the net name, put the same net label in EasyEDA and the pins join. Hover a wire to highlight its net, click to mark it wired (saved in this browser).

Sheet 1: USB-C, V-USB interface, target power

USB-C INPUT

16-pin USB 2.0 Type-C receptacle, one 5.1 k pull-down on EACH of CC1 and CC2 (so C-to-C cables and chargers give 5 V), USBLC6 ESD part on D+ / D-, 500 mA PTC fuse from VBUS to the +5V rail.

J1USB-C 16-pin receptacle (USB 2.0)[C165948]R15.1 k 1206, CC1 pull-down[C26033]R25.1 k 1206, CC2 pull-down[C26033]U2USBLC6-2SC6 ESD on D+ / D-[C7519]F1PTC 500 mA 1206, VBUS to +5V[C163512]C2100 nF 1206 on VBUS[C24497]A4B9 VBUSVBUSB4A9 VBUSVBUSA1B12 GNDGNDB1A12 GNDGNDA5 CC1CC1B5 CC2CC2A6 DP1USB_DP_JB6 DP2USB_DP_JA7 DN1USB_DN_JB7 DN2USB_DN_JA8 SBU1no connectB8 SBU2no connectEH1-4 shellGND1CC12GND1CC22GND1 I/O1USB_DP_J6 I/O1USB_DP_J3 I/O2USB_DN_J4 I/O2USB_DN_J5 VBUSVBUS2 GNDGND1VBUS2+5V1VBUS2GND

V-USB LINE INTERFACE

The classic USBasp low-speed USB interface: 68 R series resistors, 3.6 V zener clamps (the ATmega8A runs at 5 V) and the 2.2 k pull-up on D- that tells the PC this is a low-speed device.

R368 R 1206, D+ series[C17976]R468 R 1206, D- series[C17976]D13.6 V zener, D+ clamp[C725453]D23.6 V zener, D- clamp[C725453]R52.2 k 1206, D- pull-up (low speed)[C17948]C110 uF 1206, +5V bulk[C9807]1USB_DP_J2USB_DP1USB_DN_J2USB_DNKUSB_DPAGNDKUSB_DNAGND1+5V2USB_DN1+5V2GND

TARGET POWER (5 V / 3.3 V / OFF)

AP2112K 3.3 V LDO. Jumper JP1 picks what the board sends to the target: 5 V (1-2), 3.3 V (2-3) or nothing (no jumper, target has its own supply). A 200 mA PTC fuse limits a shorted target; yellow LED = we are powering the target.

U3AP2112K-3.3 LDO, SOT-25[C51118]C810 uF 1206, LDO input[C9807]C910 uF 1206, LDO output[C9807]JP11x3 header: target supply 5 V (1-2) / 3.3 V [C492402]F2PTC 200 mA 1206, target supply limit[C207035]LED3Yellow LED: powering the target[C965803]R91 k 1206, LED3 series[C4410]1 VIN+5V2 GNDGND3 EN+5V4 NCno connect5 VOUT+3V31+5V2GND1+3V32GND1 5V+5V2 OUTVTGT_SUP3 3V3+3V31VTGT_SUP2VTGTALED_T_AKGND1VTGT_SUP2LED_T_A

Sheet 2: ATmega8A core

ATMEGA8A CORE

ATmega8A-AU at 5 V with a 12 MHz crystal, running the unchanged USBasp firmware. Red LED (PC1) = programming, green LED (PC0) = USB ready. J4 = 6-pin header to flash this ATmega8A itself; JP2 = slow SCK jumper on PC2.

U1ATmega8A-AU, TQFP-32[C16190]Y112 MHz crystal 3225[C9002]C322 pF 0805, XTAL1 load[C1804]C422 pF 0805, XTAL2 load[C1804]C5100 nF 1206, VCC pin 4[C24497]C6100 nF 1206, VCC pin 6[C24497]C7100 nF 1206, AVCC pin 18[C24497]R610 k 1206, RESET pull-up[C17902]LED1Red LED: programming (PC1 low)[C965798]R71 k 1206, LED1 series[C4410]LED2Green LED: USB ready (PC0 low)[C2986059]R81 k 1206, LED2 series[C4410]J42x3 header: flash THIS ATmega8A (self-progra[C65114]JP21x2 header: slow SCK jumper (PC2 to GND)[C492401]1 PD3no connect2 PD4no connect3 GNDGND4 VCC+5V5 GNDGND6 VCC+5V7 PB6 XTAL1XTAL18 PB7 XTAL2XTAL29 PD5no connect10 PD6no connect11 PD7no connect12 PB0USB_DN13 PB1USB_DP14 PB2RST_M15 PB3 MOSIMOSI_M16 PB4 MISOMISO_M17 PB5 SCKSCK_M18 AVCC+5V19 ADC6no connect20 AREFno connect21 GNDGND22 ADC7no connect23 PC0LED_G_K24 PC1BUSY_N25 PC2SLOW_SCK26 PC3no connect27 PC4no connect28 PC5no connect29 PC6 RESETMCU_RST30 PD0no connect31 PD1no connect32 PD2 INT0USB_DP1XTAL12 GNDGND3XTAL24 GNDGND1XTAL12GND1XTAL22GND1+5V2GND1+5V2GND1+5V2GND1+5V2MCU_RSTALED_R_AKBUSY_N1+5V2LED_R_AALED_G_AKLED_G_K1+5V2LED_G_A1 MISOMISO_M2 VCC+5V3 SCKSCK_M4 MOSIMOSI_M5 RSTMCU_RST6 GNDGND1SLOW_SCK2GND

Sheet 3: Level shifter and ISP headers

LEVEL SHIFTER 1.8 - 5.5 V

74LVC8T245 drives MOSI, SCK and RST to the target at the TARGET's voltage (VTGT); 74LVC1T45 brings MISO back to 5 V. The red-LED line (PC1, low only while programming) enables the outputs, so the target pins are released (Hi-Z) the rest of the time.

U474LVC8T245PW 8-bit dual-supply transceiver, [C458788]U574LVC1T45GW 1-bit dual-supply transceiver (M[C478004]C10100 nF 1206, U4 VCCA[C24497]C11100 nF 1206, U4 VCCB[C24497]C12100 nF 1206, U5 VCCA[C24497]C13100 nF 1206, U5 VCCB[C24497]R1010 k 1206, OE# pull-up (outputs off while th[C17902]R11100 k 1206, MOSI_M pull-down (no floating in[C17900]R12100 k 1206, SCK_M pull-down[C17900]R13100 k 1206, RST_M pull-down[C17900]1 VCCA+5V2 DIR+5V3 A1MOSI_M4 A2SCK_M5 A3RST_M6 A4GND7 A5GND8 A6GND9 A7GND10 A8GND11 GNDGND12 GNDGND13 GNDGND14 B8no connect15 B7no connect16 B6no connect17 B5no connect18 B4no connect19 B3RST_T20 B2SCK_T21 B1MOSI_T22 OE#BUSY_N23 VCCBVTGT24 VCCBVTGT1 VCCA+5V2 GNDGND3 AMISO_M4 BMISO_T5 DIRGND6 VCCBVTGT1+5V2GND1VTGT2GND1+5V2GND1VTGT2GND1+5V2BUSY_N1MOSI_M2GND1SCK_M2GND1RST_M2GND

ISP HEADERS

Standard AVR 10-pin box header and 6-pin header, both on the shifted target nets. Pin 2 (VCC) is the target supply sense, and the supply output when JP1 is fitted.

J22x5 box header: standard AVR 10-pin ISP[C5665]J32x3 header: standard AVR 6-pin ISP[C65114]1 MOSIMOSI_T2 VCCVTGT3 NCno connect4 GNDGND5 RSTRST_T6 GNDGND7 SCKSCK_T8 GNDGND9 MISOMISO_T10 GNDGND1 MISOMISO_T2 VCCVTGT3 SCKSCK_T4 MOSIMOSI_T5 RSTRST_T6 GNDGND