🛠 Graver Optiboot par ICSP : +1,5 Ko de flash et upload accéléré
Objectives
The factory bootloader on the Pro Mini (ATmegaBOOT, STK500 v1 protocol at 57600 baud) reserves 2 KB of flash: the sketch is limited to 30,720 bytes. Optiboot is only 512 bytes — "only 512 bytes, freeing 1.5k of extra code space compared to older bootloaders" — starts immediately after power-on (fastboot) and accepts higher baud rates; it is explicitly compatible with the Pro line. We burn this bootloader via ICSP (the SPI pins 10-13 + RESET accept an ISP programmer) and recover 32,256 bytes of flash, just like on an Uno.
Hardware
- 1 × Arduino Pro Mini (ATmega328P; first save the fuses read:
avrdude -vdisplays them) - 1 × ISP programmer: another Arduino board with the ArduinoISP sketch, or USBasp
- 6 × cables: MOSI→11, MISO→12, SCK→13, RESET→RESET, VCC, GND (power the Pro Mini, e.g., via its regulator from 5 V on RAW or directly to VCC)
- Arduino IDE with the
arduino:avrcore, oravrdudevia command line - >
Complete Code
1. Cote MAITRE : televerser le sketch File > Examples > 11.ArduinoISP
> ArduinoISP, puis Tools > Programmer > « Arduino as ISP ».
2. Graver le bootloader via l'IDE (carte « Arduino Pro or Pro Mini »
+ CPU 5V/16MHz) : Tools > Burn Bootloader. L'IDE ecrit le
firmware, les fusibles et la signature en une passe.
3. Alternative avrdude manuelle (hex Optiboot telecharge) :
avrdude -c arduino -P COMx -b 19200 -p m328p -U lock:w:0x3F:m
puis ecriture de optiboot_atmega328.hex en flash, puis lock 0x0F.
(fusibles cristal 16 MHz : lfuse 0xFF, hfuse 0xDE ; l'efuse encode
la taille du bootloader — laissez l'IDE la choisir)
4. Verifier : avrdude -c arduino -P COMx -b 19200 -p m328p -v
l'efuse lu doit correspondre a un bootloader de 512 o (Optiboot)
et non 2 Ko (ATmegaBOOT).
Expected Verification
After burning, a classic serial upload works again via the 6-pin connector (the IDE Pro Mini profile remains at 57600, a speed Optiboot also accepts). The maximum sketch size increases from 30,720 to 32,256 bytes: a sketch that previously refused to fit now compiles. When powered on via battery, the sketch starts without the delay of the old ATmegaBOOT (fastboot).
Common Errors
- Burning with the wrong fuse set: an incorrect BOD level or using the internal clock instead of the external crystal bricks the serial link and causes boot loops; only burn what the IDE or the
boards.txtfile specifies forpro16MHzatmega328. - Forgetting to unlock the lock bits (0x3F before burning, 0x0F after):
avrduderefuses to write to flash, "chip is locked". - Confusing the two IDE menus: "Burn Bootloader" uses the already configured programmer; the ArduinoISP sketch must first be uploaded to the master board.
- Crossing MOSI/MISO between master and target as if for a serial connection: in ISP, wire pin-to-pin, never mirrored — otherwise "device not responding".
- Believing the 3.3 V/8 MHz profile is interchangeable: the 8 MHz model has its own Optiboot hex (
pro_8MHz) and its own fuses; the original ATmega168 3.3 V set even selects the internal RC oscillator (low_fuses=0xc6).
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-poussoir.inoArduinopwm-fade.inoArduinocapteur-lumiere-ldr.inoArduinoservo-balayage.inoArduinoruban-neopixel.inoArduino