Been playing around again tonight with QTimers. Interesting idea of using QT3 in quadrature - employing QT3_Timer0 on pin 19 and QT3_Timer1 on pin 18.
This example also uses the "Alternating Compare1 and Compare2" mode to get a particular Mark/Space ratio of 1us/9uS. The basic idea here is that Compare1 OFLAG output sets the "Space" timing and Compare2 OFLAG output sets the "Mark" timing. The "software model" counts up to Compare1 first and resets to zero, before switching and counting to Compare2 then resets to zero... ad infinitum. The clock is the peripheral clock of 150 MHz.
With QT3_Timer2 and QT3_Timer3 also available on pins 14 and 15, then the option of three phase or four phase signals is possible too. The preset count for QT3_Timer1 was obtain by simple trial and error. Perhaps a common trigger signal might be available to kick them off in a more professional way.
Edit. Not really "quadrature" in the true sense, but you get the gist (is it two phase?).

Code:
//TestT4007 - QTIMER TEST PROGRAM for T4
//======================================
//Author: TelephoneBill
//Date: 19 JUL 2019
//NOTES: Using QT3 as timer. Testing alternate Compare1 and Compare2 for sq wave output and ISR.
//Compare1 determines '0' (space) period, Compare2 determines '1' (mark) period - these alternate.
//Output Pulse = 1uS wide every 10uS (100 KHz). Uses QT3Timer0 and QT3Timer1 in quadrature.
//definitions
bool PrintISRTicksOn;
byte Byte1;
volatile uint32_t ISRTicks = 0;
//SETUP
//=====
void setup() {
//initialise general hardware
Serial.begin(115200); //setup serial port
pinMode(13, OUTPUT); //pin 13 as digital output
FlashLED(4); //confidence boost on startup
//enable clocks for QTIMER3
CCM_CCGR6 |= 0xC0000000; //enable clocks to CG15 of CGR6 for QT3
//configure QTIMER3 Timer0 for test of alternating Compare1 and Compare2
TMR3_CTRL0 = 0b0000000000100000; //stop all functions of timer
TMR3_SCTRL0 = 0b0000000000000001; //0(TimerCompareFlag),0(TimerCompareIntEnable),00(TimerOverflow)0000(NoCapture),0000(Capture Disabled),00, 0,1(OFLAG to Ext Pin)
TMR3_CNTR0 = 0;
TMR3_LOAD0 = 0;
TMR3_COMP10 = 1350-1; //6.7nS per clock = 9uS for 1350 clocks on first half cycle (space)
TMR3_CMPLD10 = 1350-1;
TMR3_COMP20 = 150-1; //6.7nS per clock = 1uS for 150 clocks on second half cycle (mark) = 10uS total for Compare1 and Compare2 alternating
TMR3_CMPLD20 = 150-1;
TMR3_CSCTRL0 = 0b0000000010000101; //Compare1 only enabled - Compare Load1 control and Compare Load2 control both on
TMR3_CTRL0 = 0b0011000000100100; // 001(Count rising edges Primary Source),1000(IP Bus Clock),00 (Secondary Source),
// 0(Count Once),1(Count up to Compare),0(Count Up),0(Co Channel Init),100(Toggle OFLAG on alternating Compare1/Compare2)
//configure QTIMER3 Timer1 for test of alternating Compare1 and Compare2
TMR3_CTRL1 = 0b0000000000100000; //stop all functions of timer
TMR3_SCTRL1 = 0b0000000000000001; //0(TimerCompareFlag),0(TimerCompareIntEnable),00(TimerOverflow)0000(NoCapture),0000(Capture Disabled),00, 0,1(OFLAG to Ext Pin)
TMR3_CNTR1 = 325;
TMR3_LOAD1 = 0;
TMR3_COMP11 = 1350-1; //6.7nS per clock = 9uS for 1350 clocks on first half cycle (space)
TMR3_CMPLD11 = 1350-1;
TMR3_COMP21 = 150-1; //6.7nS per clock = 1uS for 150 clocks on second half cycle (mark) = 10uS total for Compare1 and Compare2 alternating
TMR3_CMPLD21 = 150-1;
TMR3_CSCTRL1 = 0b0000000010000101; //Compare1 only enabled - Compare Load1 control and Compare Load2 control both on
TMR3_CTRL1 = 0b0011000000100100; // 001(Count rising edges Primary Source),1000(IP Bus Clock),00 (Secondary Source),
// 0(Count Once),1(Count up to Compare),0(Count Up),0(Co Channel Init),100(Toggle OFLAG on alternating Compare1/Compare2)
//configure Teensy pin Compare output
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00 = 1; // QT3 Timer0 is now on pin 19
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01 = 1; // QT3 Timer1 is now on pin 18
//enable QT3 interrupt within NVIC table
attachInterruptVector(IRQ_QTIMER3, QT3_isr); //declare which routine performs the ISR function
NVIC_ENABLE_IRQ(IRQ_QTIMER3);
}
//ISR ROUTINE FOR QT3
//====================
//FASTRUN puts this code into RAM to run twice as fast
FASTRUN void QT3_isr(void) {
TMR3_SCTRL0 &= ~(TMR_SCTRL_TCF);
TMR3_CSCTRL0 &= ~(TMR_CSCTRL_TCF1|TMR_CSCTRL_TCF2);
TMR3_SCTRL1 &= ~(TMR_SCTRL_TCF);
TMR3_CSCTRL1 &= ~(TMR_CSCTRL_TCF1|TMR_CSCTRL_TCF2);
ISRTicks++;
asm volatile("dsb");
}
//MAIN LOOP
//=========
void loop() {
//call KeyInput() routine
KeyInput();
if ((ISRTicks%10000)==0) {
digitalWriteFast(13, 1);
delay(10);
digitalWriteFast(13, 0);
if (PrintISRTicksOn) {
Serial.print("ISRTicks = "); Serial.println(ISRTicks);
}
}
}
//SUBROUTINES
//===========
//Flash LED routine
void FlashLED(int m) {
for (int n=0;n<m;n++) {
digitalWriteFast(13, 1); //set pin 13 high
delay(100);
digitalWriteFast(13, 0); //set pin 13 low
delay(100);
}
}
//KeyInput routine
void KeyInput() {
//process any keystrokes available
if (Serial.available()>0) {
//read the incoming byte
Byte1 = Serial.read();
if (Byte1>0x20) {
switch (Byte1) {
case 'T': //print the ISRTicks value
//task goes here...
PrintISRTicksOn = !PrintISRTicksOn; //toggle print status
break;
}
}
}
}