🛠 Programmer par FTDI et dompter le bootloader

LilyPad Arduino · avance · Schéma : IMG-lilypad-avance-2-lilypad-ftdi-bootloader.svg — LilyPad reliée à un adaptateur FTDI USB-série, ligne DTR mise en évidence et quartz 8 MHz encadré à côté d'un 16 MHz barré.

Objectives

Master the FTDI → LilyPad programming chain: VCP driver, serial port, ATmegaBOOT bootloader (the "pro 8 MHz" hex compatible with Optiboot), automatic reset via the DTR line, and a 57600 baud upload rate for the ATmega328P option. Also learn how to diagnose a misconfigured bootloader or clock.

Hardware

Complete Code

// Test de chaîne : timing exact + série pour valider bootloader, FTDI et horloge
// Carte requise : « LilyPad Arduino » (ATmega328P @ 8 MHz, upload 57600 bauds)
const uint8_t LED = 13;

void setup {
  Serial.begin(9600);
  Serial.println(F("Boot OK — 8 MHz"));
  pinMode(LED, OUTPUT);
}

void loop {
  unsigned long t0 = micros;
  digitalWrite(LED, HIGH);
  delay(1000);                   // doit durer 1,000 s pile si F_CPU = 8 MHz
  digitalWrite(LED, LOW);
  unsigned long t1 = micros;
  Serial.print(F("delay(1000) mesure : ")); // ~1 000 000 µs attendu
  Serial.print(t1 - t0);                    // ~2 000 000 => configuré 16 MHz !
  Serial.println(F(" us"));
  delay(1000);
}

Expected Verification

After uploading, the serial monitor (9600) displays "Boot OK — 8 MHz" followed by lines close to 1,000,000 µs: the bootloader, clock, and FTDI are correct. The automatic reset works: each time you click "Upload", the IDE resets the board without pressing the button. A factor of 2 (≈2,000,000 µs) indicates a 16 MHz configuration.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials