So, I thought I was going crazy but I think there's an issue with the edge triggering interrupts on Teensy 4.1. If I set a RISING or FALLING interrupt using attachInterrupt then I will occasionally see the ISR getting called on the wrong edge
Here is a basic example sketch:
The code should toggle the output pin every time there is a falling edge on the input pin, which it does most of the time, however here is a waveform I captured showing the result. On this Yellow is the input signal (pin 20) and green is the output (Pin 10)
There are these odd short pulses on the output signal (green) that always align with the rising edge of the input signal. As far as I can see, this means that the ISR is occasionally getting called on the RISING edge as well as the FALLING one. I have a reasonable cap on the input signal, so I don't think this is caused by hardware noise.
I did wonder whether this was something to do with the specific pin I'm using for the input, but I've tried other pins and gotten the same result.
Is anyone else able to try and see if they can reproduce this?
Here is a basic example sketch:
Code:
void setup() {
pinMode(10, OUTPUT);
attachInterrupt(20, pinFallingISR, FALLING);
}
// the loop function runs over and over again forever
void loop() {
}
void pinFallingISR()
{
digitalWrite(10, !digitalRead(10));
}
The code should toggle the output pin every time there is a falling edge on the input pin, which it does most of the time, however here is a waveform I captured showing the result. On this Yellow is the input signal (pin 20) and green is the output (Pin 10)
There are these odd short pulses on the output signal (green) that always align with the rising edge of the input signal. As far as I can see, this means that the ISR is occasionally getting called on the RISING edge as well as the FALLING one. I have a reasonable cap on the input signal, so I don't think this is caused by hardware noise.
I did wonder whether this was something to do with the specific pin I'm using for the input, but I've tried other pins and gotten the same result.
Is anyone else able to try and see if they can reproduce this?