I have a bigger program moved from the traditional Arduino's (UNO, MEGA) to the Nano Every (4809). Basically everything works. However I noticed on my logic analyser quite a difference between the times interrups are raised and the ISR is entered. On the classical Arduino's it takes less than one microsec (when compiling with board: "Arduino Mega or Mega 2560") , but on the Every it takes between 6 microseconds (when compiling with MegaCoreX an board: "ATMega 4809 / Pinout: Nano Every") or even 8 microseconds (when compiling with board: "Arduino Nano Every" / Registers Emulation: None").
I made a test setup with an Arduino Mega 2560 and an Arduino Nano Every. The input signal that triggers the interrupt is in both cases identical. I wrote the following test code:
#define InputSignalPin 19 // INT2 om the Mega 2560 - PF3 on the Nano Every
void test_interrupt(void) {
// ISR Start
#if defined(__AVR_ATmega2560__)
PORTF |= (1<<2);
PORTF &= ~(1<<2);
#endif
#if defined(__AVR_ATmega4809__)
PORTF.OUT |= PIN2_bm;
PORTF.OUT &= ~(PIN2_bm);
;
#endif
}
void setup() {
// Use PF2 as output pin for the logic analyser
#if defined(__AVR_ATmega2560__)
DDRF |= (1<<2); // Set PF2 as output
#endif
#if defined(__AVR_ATmega4809__)
PORTF.DIR |= (1 << PIN2_bp);
#endif
// Set the Interrupt pin as input
pinMode(InputSignalPin, INPUT);
attachInterrupt(digitalPinToInterrupt(InputSignalPin), test_interrupt, FALLING );
}
void loop() {
}
Any idea what might cause this very long time between the time the interrupt signal appears, and the moment the ISR becomes active on the new Arduino Nano Every?