Nearly all AVRs have a 'serial' programming interface, that's what we'll be using to program them. If your chip requires SWD, JTAG or parallel, this software won't work!
In this example we'll show how to wire up an existing Arduino 328P compatible or raw 328P chip to a Feather M0 for programming
For other chips, the wiring is similar, but you'll need to look up which pins are Power, Ground, Reset, and SCK/MOSI/MISO
Do these pins first because they're easy to forget!
- If connecting to a Arduino-compatible: connect GND on the Arduino to GND on the Feather. Then either plug the Arduino into USB, or connect the Arduino 5V to Feather USB
- If connecting to a bare chip: connect both GND pins together and to the Feather GND. Connect AVCC to VCC to the Feather 3V pin
- Connect the CircuitPython SCK pin to the target SCK (on Uno/Atmega328 this is also known as Digital #13)
- Connect the CircuitPython MISO pin to the target MISO (on Uno/Atmega328 this is also known as Digital #12)
- Connect the CircuitPython MOSI pin to the target MOSI (on Uno/Atmega328 this is also known as Digital #11)
- Connect CircuitPython D5 (or any digital pin, as long as you change the code too) to the target RESET
If you are breadboarding a chip, it may need a clock or crystal and it needs to be there to program the chip! If your board has a crystal or oscillator already, skip this. If you're programming a 'raw' ATmega328, you'll want to add it:
- Connect CircuitPython D9 (or any digital pin with PWM out, as long as you change the code to) to the target XTAL1
Notice that the notch on the chip is to the right - away from the Feather!
For Arduino UNO and compatibles, we recommend powering from USB or DC power. Then connect GND pins together, and wire up Reset, SCK, MOSI, and MISO as seen above.
XTAL pin is not required, Arduinos have on-board crystals.