Pololu-Romi-32U4-A-Star-Bootloader

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche

Introduction

La famille de carte 32U4 de Pololu dispose d'un bootloader USB qui peut être utilisé avec Arduino IDE ou AVRDUDE pour charger un nouveau programme dans le périphérique. Cette section du document contient des détails techniques concernant le bootloader. Ces informations intéresserons les utilisateurs avancés désirants avoir une meilleure compréhension de son fonctionnement interne. Si vous voulez désirer seulement utiliser votre périphérique alors vous pouvez simplement ignorer cette section.

Le Bootloader de l'A-Star 32U4 est basé sur le bootloader Caterina utilisé par les Arduino Leonardo, Arduino Micro et plusieurs autres cartes ATmega32U4. Ce bootloader est Open Source et son code source est disponible sur GitHub. The bootloader utilise les 4 premiers kilooctets dans la mémoire programme de ATmega32U4, laissant ainsi 28 Kio pour les programmes utilisateurs. Le bootloader de l'interface USB consiste en un simple port série virtuel acceptant des commandes de programmation telles que définies dans le document AVR109. Le bootloader démarre toujours en premier après une réinitialisation/reset de l'AVR.

Logique de démarrage

he main difference between the A-Star 32U4 Bootloader and Caterina is in the startup logic. This is the part of the bootloader that runs immediately after the AVR is reset, and it decides whether to run the user program or run the rest of the bootloader. The startup logic of the Caterina bootloader is designed so that when the RST line goes low, the bootloader will run. This means that if you want to restart your program using the RST line, it will take 8 seconds before the bootloader times out waiting for an upload and the sketch starts.

The A-Star 32U4 Bootloader has different startup logic that allows you to use the RST line to reset the board with a smaller delay. If the RST line goes low once, the user program will run after a 750 ms delay. If the RST line goes low twice within 750 ms, then the bootloader will run. (This behavior is the same as on boards like SparkFun’s Pro Micro.)

The start-up logic of the A-Star 32U4 Bootloader is shown in the flowchart below:

Pololu-Romi-32U4-A-Star-Bootloader-00.jpg

Détection Brown-out

Le "Brown out" est une brève baisse de tension qui se produit généralement à la mise sous-tension. De nombreux microcontrôleurs intègre un mécanisme de détection de Brown-out.

Unlike many other ATmega32U4 boards, our 32U4 family of boards have brown-out detection enabled. The brown-out threshold is 4.3 V, and if the voltage on VCC goes below this then the AVR will reset. The bootloader was designed so that the user program can detect brown-out resets. To do so, check to see if the BORF bit in the MCUSR register is set, and then clear it later. Here is some example code you could put in your setup function for detecting brown-out resets:

pinMode(13, OUTPUT);
if (MCUSR & (1 << BORF))
{
  // A brownout reset occurred.  Blink the LED
  // quickly for 2 seconds.
  for(uint8_t i = 0; i < 10; i++)
  {
    digitalWrite(13, HIGH);
    delay(100);
    digitalWrite(13, LOW);
    delay(100);
  }
}
MCUSR = 0;



Basé sur "Guide utilisateur de la carte de contrôle Romi 32U4" de Pololu (https://www.pololu.com/docs/0J69) - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction". Traduit avec l'autorisation expresse de Pololu (www.pololu.com)

Based on "Pololu Romi 32U4 Control Board User’s Guide" from Pololu (https://www.pololu.com/docs/0J69) - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit). Translated with the Pololu's authorization (www.pololu.com)