🛠 Convertir la Duemilanove en programmateur AVR (ArduinoISP) pour graver des puces nues
Objectives
The Duemilanove has a 2×3 ICSP connector, and the ATmega168/328 speaks the same language as any other AVR: using the ArduinoISP example from the core, the board becomes a serial AVR-ISP programmer. You will burn a bootloader onto a bare ATmega328P to turn it into a standalone Uno/Duemilanove clone — the classic approach for making custom boards, documented in the official "Programmer" tutorial.
Hardware
- 1 Arduino Duemilanove (the programmer)
- 1 bare ATmega328P (or 168) + socket/DIP socket on a breadboard
- 1 16 MHz crystal + 2 22 pF ceramic capacitors (or use the internal 8 MHz oscillator, by adjusting the fuses)
- 1 10 kΩ resistor on RESET, powered by the Duemilanove's 5 V (the target draws little current at idle; watch out for the board's 500 mA polyfuse)
- 6 wires + USB cable; optionally an LED on pin 13 to monitor activity
Complete Code
1) Charger l'exemple : Fichier > Exemples > 11.ArduinoISP > ArduinoISP
(sur les vieux IDE : Examples > ArduinoISP). Televerser sur la
Duemilanove avec le bon processeur (328 : 57600 / 168 : 19200).
2) Cables cible (Duemilanove -> ATmega nu, boitier DIP-28) :
MOSI = broche 11 -> broche 17 (PC4)
MISO = broche 12 -> broche 18 (PC5)
SCK = broche 13 -> broche 19 (PC6)
RESET= broche 10 -> broche 1 (avec pull-up 10k vers VCC)
VCC = 5V -> broches 7 et 21 ; GND -> broches 8 et 22
3) IDE : Outils > Programmateur > "Arduino as ISP" (le vieux nom
"Arduino as ISP (ATmega328)" selon les versions).
4) Graver les fusibles puis le bootloader :
Outils > Graver les fusibles (optionnel, cf. valeurs ci-dessous)
Outils > Graver la sequenceur de demarrage (bootloader "Arduino on a Breadboard")
puis televerser un Blink en choisissant "Arduino Duemilanove or
Diecimila / ATmega328" comme carte et "Arduino as ISP" si besoin.
Valeurs de fusibles officielles (ArduinoCore-avr boards.txt) :
ATmega328 : low=0xFF high=0xDA extended=0xFD (lock bits 0x0F)
ATmega168 : low=0xFF high=0xDD extended=0xF8
Ligne de commande equivalente :
avrdude -c arduino -p m328p -P COM7 -b 19200 -U lfuse:r:-:h -U hfuse:r:-:h
Expected Verification
"Burn Bootloader" completes without a "not responding" error; reading the fuses returns low=0xFF, high=0xDA, extended=0xFD for a 328. After burning the bootloader, uploading a Blink sketch (board: Duemilanove/ATmega328) makes the target's LED blink when powered independently — the bare chip has become a fully functional board.
Common Errors
- Forgetting to change Tools > Programmer: the IDE stays on "Default Programmer" and talks to the Duemilanove's bootloader instead of the ISP — resulting in an "Expected signature" message.
- Wrong pin number for the target RESET: in ArduinoISP, pin 10 of the Arduino programmer controls the target's RESET (and also serves as SS to prevent SPI slave mode).
- Missing crystal without configuring the fuses: with "full crystal" fuses and no crystal, the chip won't start; for the internal 8 MHz oscillator, use dedicated fuses (low=0xE2 on 328) — otherwise keep the 16 MHz crystal.
- Powering the target from another source while also connected to the programmer's 5 V: a classic power supply conflict that makes programming unreliable.
- Swapping MISO/MOSI: unreadable signature (0x00 or 0xFFFFFF); check pins 17/18 on the DIP-28.
- Burning fuses that disable the RESET pin or SPI: the chip becomes inaccessible via ISP — do not touch security fuses without a safety net.
- Confusing baud rates: the ArduinoISP programmer runs at 19200 baud on the avrdude side (
-b 19200), even though the Duemilanove's bootloader uses 57600 for a 328.
Other tutorials for this board
- Faire clignoter la LED 13 d'une Duemilanove (et choisir le bon ATmega)
- Bouton poussoir et moniteur série sur la Duemilanove (avec ses 0,5 s de silence)
- Potentiomètre et variation LED : l'ADC 10 bits et le PWM 8 bits version AVR
- Ajouter un deuxième port série avec SoftwareSerial (GPS sur broches 10/11)
- Régler la référence de mesure avec AREF et analogReference
- Persister une calibration dans l'EEPROM de l'ATmega (512 octets ou 1 Ko)
Code examples for this board
clignotante.inoArduinobouton-led.inoArduinopwm-respiration.inoArduinopotentiometre-plotter.inoArduinoservo-balayage.inoArduinobuzzer-melodie.inoArduino