Bonjour,
Je reviens vers vous pour un problème d'utilisation de l'Arduino Pro-Mini.
J'ai choisi ce module pour son faible encombrement et la possibilité de le mettre en veille pour limiter la consommation d'une pile de 3.7V.
Le programme est celui d'un fréquencemètre pour un anémomètre. Programme qui fonctionne avec un arduino UNO. J'utilise VSCODE;
J'avais précédemment utilisé ce module avec un petit programme d'essai avec succès.
Le core a été déclaré en "Arduino Pro et Pro-mini atmega 328P (voir "Platform.ini).
**; PlatformIO Project Configuration File**
**;**
**; Build options: build flags, source filter**
**; Upload options: custom upload port, speed and extra flags**
**; Library options: dependencies, extra library storages**
**; Advanced options: extra scripting**
**;**
**; Please visit documentation for the other options and examples**
**; https://docs.platformio.org/page/projectconf.html**
**[env:pro8MHzatmega328]**
**platform = atmelavr**
**board = pro8MHzatmega328**
**framework = arduino**
Voici le programme :
/*
Essais avec INTERRUPTIONS - pin 2 utilisée - Détection de PULSE par "FALLING"
La bande de fréquences utilisée est <= 250 Hz
*/
#define PIN_INPUT 2 // Pin ATACH INTERRUPT
#define DELAI_ENTRE_DEUX_PULSE 3 // Delai doit être >= 4 ms pour fréquence 250Hz max
volatile int NB_PULSE = 0;
volatile float PRECEDENT_DEPART = 0;
float FREQUENCE = 0.0;
#define TEMPORISATION 1000 //Lecture sur 1s pour avoir F avec NB_PULSE
void ISR_PULSE() // Fonction d'interruption
{
static uint32_t precedentIT = 0;
uint32_t _millis = millis(); // _millis = variable temporaire
if (precedentIT - _millis >= DELAI_ENTRE_DEUX_PULSE )
{
NB_PULSE++;
}
precedentIT = _millis;
}
void setup()
{
Serial.begin(9600);
pinMode(PIN_INPUT, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PIN_INPUT), ISR_PULSE, FALLING);
}
void loop()
{
while ((millis() - PRECEDENT_DEPART) <= TEMPORISATION)
{
int _NB_PULSE;
uint8_t oldSREG = SREG; // Mémorisation de l'état du gestionnaire de registres
/* Le bit 7 du registre SREG est mis à 0 pour que _NB_PULSE
soit mis en mémoire et non dans deux registres de 8 bits */
cli(); // ou SREG &= ~(1<<I) ; I étant le bit 7 du registre
_NB_PULSE = NB_PULSE;
// on redonne la main au gestionnaire des registres dans l'état de départ
SREG = oldSREG;
Serial.println(_NB_PULSE);
}
FREQUENCE = NB_PULSE;
Serial.print("FREQUENCE : ");
Serial.print(FREQUENCE);
Serial.println(" Hz");
Serial.println();
delay(5000);
PRECEDENT_DEPART = millis();
NB_PULSE = 0;
}
Je reçois le message d'erreurs suivant lors du téléchargement même si je le déclare en ESP8266.
Auto-detected: COM6
Uploading .pio\build\pro8MHzatmega328\firmware.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
*** [upload] Error 1
=============================================================== [FAILED] Took 5.40 seconds ===============================================================
* Arrêt du processus de terminal "C:\Users\Utilisateur\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'". Code de sortie : 1.
* Le terminal sera réutilisé par les tâches, appuyez sur une touche pour le fermer.
Apparemment, même si je sélectionne

Le core correct, dans la plateform.ini, il apparaît avec 8MHz et non 16MHz.
D'où vient ce blocage inattendu ?
Ou, quel type de core dois-je choisir ?
Merci pour vos réponses.
Bébert

