Sorry in advance for these ramblings
But maybe something might work.
Both of these things are trying to use this pin in two different ways. Driven by Timer and trying to get interrupt like it was an IO pin.
Looking at the data associated with this pin: 23 4A1 A9 RX1 3:9 MCL1 1.25 AD-B1_09
There may be some straight forward ways of getting the interrupt like you tried not sure if that exact way would do it. You might try doing the attach before you do the AnalogWrite stuff to see if maybe the interrupt data will persist. I have my doubts.
If not and if I were playing, I would try things like:
Code:
22 [COLOR="#FF0000"]4A0 [/COLOR]A8 TX1 3:08 1.24 AD_B1_08
From my document P497 shows all of the things this pin does with the different MUX_MODES
and likewise sources in cores\teensy4\pwm.c, I See that this PWM is done by FLEXPWM4_PWMA01
Code:
{1, M(4, 0), 1, 1}, // FlexPWM4_0_A 22 // AD_B1_08
So this pin uses the FlexPWM timer system to do the PWM. So after the PWM is hooked up I might try experimenting with setting up an interrupt through the timer and see if they worked together.
Looking at imxrt.h I see there is an interrupt vector:
So wonder what would happen if I set up an interruptVector for this one, like a few libraries do, like: FreqMeasureMulti
You would need to do all of the normal things like enable enable the interrupt and the like.
The data that this is on Timer Module 4, SubModule 0, and Pin A
I would then look at the timers registers, probably, then look at the INTEN register associated with this pin.
Something like IMXRT_FLEXPWM4.SM[0].INTEN
And look to see if either the CAPTURE A0 or A1 work... Maybe not as I think these are mainly for Input Capture and not OUTPUT
AND if that did not work. (very possible ) I would wonder if maybe I could hack up something using XBAR and ???
Again I don't know what I would try to map the XBAR in of
Again I don't know if if it would work to map something like one of:
Code:
#define XBARA1_IN_FLEXPWM4_PWM1_OUT_TRIG0 52
#define XBARA1_IN_FLEXPWM4_PWM1_OUT_TRIG1 52
#define XBARA1_IN_FLEXPWM4_PWM2_OUT_TRIG0 53
#define XBARA1_IN_FLEXPWM4_PWM2_OUT_TRIG1 53
#define XBARA1_IN_FLEXPWM4_PWM3_OUT_TRIG0 54
#define XBARA1_IN_FLEXPWM4_PWM3_OUT_TRIG1 54
#define XBARA1_IN_FLEXPWM4_PWM4_OUT_TRIG0 55
#define XBARA1_IN_FLEXPWM4_PWM4_OUT_TRIG1 55
To something else that I can get an interrupt on. It could be possible...
But depending on my needs, I would probably simply try to connect up pin 22 to some unused IO pin and the set the interrupt on that pin... But I know that is cheating.
Again sorry for these ramblings (brain dump) of things I might try if I really needed this to work.