danielbriggs
Member
Hi there,
I'm a new user of the Teensy-world, so I'm excited to get started.
I have several interrupt related questions if anyone is able to point me in the right direction of:
Theoretical interrupt question:
I want to count two different types of pulses, and trigger actions once "xxx" number of each type of pulses have been observed.
Type A pulses are slow (~100kHz) but short duration (~200ns)
Type B are VERY slow (anything between 20 and 100Hz), but a much long duration (~30µs).
Most of the time they will arrive into two GPIO pins randomly, (lets say Type A into: pin 2 (EMC_04) and Type B into: pin 3 (EMC_05), but they will often arrive at exactly the same time (well, <5ns as far as my scope can measure)... how can I make sure I count both pulses and don't miss either?
My plan was to use interrupts, and give a higher priority to the faster "Type A" pulses, and a slightly less priority to the "Type B" pulses. However if I setup an ISR for each type to just "Count++", what happens when it's servicing the higher priority iterrupt and the other pulse arrives with less priority? Is it missed? Or does it sit and wait for the first higher priority interrupt to finish, and then runs the lower priority interrupt?
If the above makes sense: is it sensible to attempt to set different priorities for individual GPIO pins, or is this a fruitless exercise? If not... again any reading material / pointers to help me understand this out would be greatly appreciated.
Increasing interrupt priority on T4.1:
On a Teensy 3.2 I tested with success:
However how is this behaviour "ported" to the T4.1 as PortA isn't a thing? I read somewhere on here that T4.1's are configured to use "fastIO", and that interrupt priority can't be changed unless they are moved back to "slowIO".
Can somepoint please point me in the direction / explain the implications of this "fast/slow" pin behaviour? How fast? How slow? Is it in any way connected to digitalWriteFast and digitalWrite?
I also read conflicting information that pins were slew rate limited by default, which would lead me to think the default mode might be "slowIO"? However this might be for older Teensys only?
All the best,
Dan
I'm a new user of the Teensy-world, so I'm excited to get started.
I have several interrupt related questions if anyone is able to point me in the right direction of:
Theoretical interrupt question:
I want to count two different types of pulses, and trigger actions once "xxx" number of each type of pulses have been observed.
Type A pulses are slow (~100kHz) but short duration (~200ns)
Type B are VERY slow (anything between 20 and 100Hz), but a much long duration (~30µs).
Most of the time they will arrive into two GPIO pins randomly, (lets say Type A into: pin 2 (EMC_04) and Type B into: pin 3 (EMC_05), but they will often arrive at exactly the same time (well, <5ns as far as my scope can measure)... how can I make sure I count both pulses and don't miss either?
My plan was to use interrupts, and give a higher priority to the faster "Type A" pulses, and a slightly less priority to the "Type B" pulses. However if I setup an ISR for each type to just "Count++", what happens when it's servicing the higher priority iterrupt and the other pulse arrives with less priority? Is it missed? Or does it sit and wait for the first higher priority interrupt to finish, and then runs the lower priority interrupt?
If the above makes sense: is it sensible to attempt to set different priorities for individual GPIO pins, or is this a fruitless exercise? If not... again any reading material / pointers to help me understand this out would be greatly appreciated.
Increasing interrupt priority on T4.1:
On a Teensy 3.2 I tested with success:
Code:
NVIC_SET_PRIORITY(IRQ_PORTA, 16)
Can somepoint please point me in the direction / explain the implications of this "fast/slow" pin behaviour? How fast? How slow? Is it in any way connected to digitalWriteFast and digitalWrite?
I also read conflicting information that pins were slew rate limited by default, which would lead me to think the default mode might be "slowIO"? However this might be for older Teensys only?
All the best,
Dan