Bonjour à tous,
Dans le cadre de mon projet de comptage des entrées sorties d'abeilles pour une ruche, j'utilise les E/S 22 a 53 d'un Arduino DUE auxquelles j'attache une interruption en RISING
sans raccordement à mon schield capteurs (donc DUE nue) malgré la mise en service des pull-up internes j'ai des interruptions parasites au démarrage
demarrage
..........
port : 22
port : 23
port : 25
port : 33
Irq2
si je force a 0 ces entrées et que je redémarre le programme j'ai d'autres entrées qui passent en interruption
demarrage
..........
port : 24
port : 26
port : 34
port : 36
Irq2
la DUE est made in Chine et je pense à des parasites du step-down sur les pistes de ces E/S,
raccordée a mon schield capteurs j'ai des phénomènes de rebond sur certaines entrées malgré que les signaux sortent d'un comparateur LM393 avec un 100nF à la masse (cela provoque parfois le plantage du DUE d'ou le chien de garde)
je joint mon code de test si certains veulent faire ce test sur d'autres cartes ...
#include <DueTimer.h> // inclusion de la librairie DueTimer pour interruption temporelle
volatile int Irq2 = 0;
const unsigned int periode = 10000000; // 10s pour les test 60s après
// --------------------------------------------------------------------
void watchdogSetup(void)
{
//obligatoire pour que le chien de garde fonctionne.
}
void setup() {
Serial.begin(57600);
Serial.println("");
Serial.println(F("demarrage"));
for (int i = 22; i <= 53; i++) {
pinMode(i, INPUT_PULLUP); // mise en service pull-up interne
}
for (int i = 0 ; i < 10 ; i++) { // délais pour stabilisation des entrées
Serial.print(F("."));
delay(1000);
}
Serial.println();
attachInterrupt(digitalPinToInterrupt(22), Irq22, RISING);
attachInterrupt(digitalPinToInterrupt(23), Irq23, RISING);
attachInterrupt(digitalPinToInterrupt(24), Irq24, RISING);
attachInterrupt(digitalPinToInterrupt(25), Irq25, RISING);
attachInterrupt(digitalPinToInterrupt(26), Irq26, RISING);
attachInterrupt(digitalPinToInterrupt(27), Irq27, RISING);
attachInterrupt(digitalPinToInterrupt(28), Irq28, RISING);
attachInterrupt(digitalPinToInterrupt(29), Irq29, RISING);
attachInterrupt(digitalPinToInterrupt(30), Irq30, RISING);
attachInterrupt(digitalPinToInterrupt(31), Irq31, RISING);
attachInterrupt(digitalPinToInterrupt(32), Irq32, RISING);
attachInterrupt(digitalPinToInterrupt(33), Irq33, RISING);
attachInterrupt(digitalPinToInterrupt(34), Irq34, RISING);
attachInterrupt(digitalPinToInterrupt(35), Irq35, RISING);
attachInterrupt(digitalPinToInterrupt(36), Irq36, RISING);
attachInterrupt(digitalPinToInterrupt(37), Irq37, RISING);
attachInterrupt(digitalPinToInterrupt(38), Irq38, RISING);
attachInterrupt(digitalPinToInterrupt(39), Irq39, RISING);
attachInterrupt(digitalPinToInterrupt(40), Irq40, RISING);
attachInterrupt(digitalPinToInterrupt(41), Irq41, RISING);
attachInterrupt(digitalPinToInterrupt(42), Irq42, RISING);
attachInterrupt(digitalPinToInterrupt(43), Irq43, RISING);
attachInterrupt(digitalPinToInterrupt(44), Irq44, RISING);
attachInterrupt(digitalPinToInterrupt(45), Irq45, RISING);
attachInterrupt(digitalPinToInterrupt(46), Irq46, RISING);
attachInterrupt(digitalPinToInterrupt(47), Irq47, RISING);
attachInterrupt(digitalPinToInterrupt(48), Irq48, RISING);
attachInterrupt(digitalPinToInterrupt(49), Irq49, RISING);
attachInterrupt(digitalPinToInterrupt(50), Irq50, RISING);
attachInterrupt(digitalPinToInterrupt(51), Irq51, RISING);
attachInterrupt(digitalPinToInterrupt(52), Irq52, RISING);
attachInterrupt(digitalPinToInterrupt(53), Irq53, RISING);
Timer2.attachInterrupt(IrqT2).setPeriod(periode).start(); //10s
watchdogEnable(8000); // active le chien de garde avec un timeout de 8s.
}
// ----------------------------------------------------------------
void loop() {
watchdogReset(); // raz du chien de garde.
if (Irq2 == 1) {
Serial.println("Irq2 ");
Irq2 = 0;
}
}
// ----------------------------------------------------------------
void detectI(int i) { // détection passage opto Intérieur
Serial.print("port : "), Serial.println(i+22);
}
// ---------------------------------------------------------------
void detectE(int i) { // détection passage opto Extérieur
Serial.print("port : "), Serial.println(i+22);
}
// -----------------------------------------------------
void IrqT2() { // toutes les minutes
Irq2 = 1;
}
// -------------------------------------
// ---------------------------------------------------------
void Irq22() {
// noInterrupts();
detectI(0);
// interrupts();
}
void Irq23() {
// noInterrupts();
detectI(1);
// interrupts();
}
void Irq24() {
//noInterrupts();
detectI(2);
//interrupts();
}
void Irq25() {
// noInterrupts();
detectI(3);
// interrupts();
}
void Irq26() {
//noInterrupts();
detectI(4);
//interrupts();
}
void Irq27() {
// noInterrupts();
detectI(5);
// interrupts();
}
void Irq28() {
// noInterrupts();
detectI(6);
// interrupts();
}
void Irq29() {
// noInterrupts();
detectI(7);
// interrupts();
}
void Irq30() {
// noInterrupts();
detectI(8);
// interrupts();
}
void Irq31() {
// noInterrupts();
detectI(9);
// interrupts();
}
void Irq32() {
// noInterrupts();
detectI(10);
// interrupts();
}
void Irq33() {
// noInterrupts();
detectI(11);
// interrupts();
}
void Irq34() {
//noInterrupts();
detectI(12);
//interrupts();
}
void Irq35() {
// noInterrupts();
detectI(13);
// interrupts();
}
void Irq36() {
// noInterrupts();
detectI(14);
// interrupts();
}
void Irq37() {
// noInterrupts();
detectI(15);
// interrupts();
}
void Irq38() {
// noInterrupts();
detectE(0);
// interrupts();
}
void Irq39() {
// noInterrupts();
detectE(1);
// interrupts();
}
void Irq40() {
// noInterrupts();
detectE(2);
// interrupts();
}
void Irq41() {
// noInterrupts();
detectE(3);
// interrupts();
}
void Irq42() {
// noInterrupts();
detectE(4);
// interrupts();
}
void Irq43() {
// noInterrupts();
detectE(5);
// interrupts();
}
void Irq44() {
// noInterrupts();
detectE(6);
// interrupts();
}
void Irq45() {
// noInterrupts();
detectE(7);
// interrupts();
}
void Irq46() {
// noInterrupts();
detectE(8);
// interrupts();
}
void Irq47() {
// noInterrupts();
detectE(9);
// interrupts();
}
void Irq48() {
// noInterrupts();
detectE(10);
// interrupts();
}
void Irq49() {
// noInterrupts();
detectE(11);
// interrupts();
}
void Irq50() {
// noInterrupts();
detectE(12);
// interrupts();
}
void Irq51() {
// noInterrupts();
detectE(13);
// interrupts();
}
void Irq52() {
// noInterrupts();
detectE(14);
// interrupts();
}
void Irq53() {
// noInterrupts();
detectE(15);
// interrupts();
}
// ------------------------------------------------------
void reset() {
while (1) {}; // blocage pour reset sur déclenchement du chien de garde.
}
// ----------------------------------------------------
si vous avez des suggestions .....