Handling simultaneous interrupts

Hi, I’m developing a project using particle photon where there are three different interrupts on DAC, D6 and D7. Each has their separate ISR. However, when I triggered them at the same time using a single signal, only one of them got registered. Any ideas on how I can get all of them handled in such a case?

What device OS are you running on your device?
I cannot confirm what you are seeing.
This is my test code

SYSTEM_THREAD(ENABLED)

volatile int a6; 
volatile int d6; 
volatile int d7; 

void setup() {
    pinMode(A6, INPUT_PULLUP);
    pinMode(D6, INPUT_PULLUP);
    pinMode(D7, INPUT_PULLUP);
    
    attachInterrupt(A6, ISRa6, FALLING);
    attachInterrupt(D6, ISRd6, FALLING);
    attachInterrupt(D7, ISRd7, FALLING);
}

void loop() {
  Serial.printlnf("%d,%d,%d", a6, d6, d7);
  delay(1000);
}

void ISRa6() { 
    static uint32_t ms = 0;
    if (millis() - ms < 50) return;
    ms = millis();
    a6++; 
}
void ISRd6() { 
    static uint32_t ms = 0;
    if (millis() - ms < 50) return;
    ms = millis();
    d6++; 
}
void ISRd7() { 
    static uint32_t ms = 0;
    if (millis() - ms < 50) return;
    ms = millis();
    d7++; 
}

I briged all three pins to the same trigger source to cause absolutely synchronous triggers and they all also fire.

4 Likes

Would you be able to explain line by line what the ISR functions are doing - is this a debounce?

Yup, the first three lines are exactly that, the only "working" line is the increment of each respectrive data variable.
Without the debounce I got dozends to even hundreds of triggers with one touch of the jumper wire to GND.