Hi, LLMike,

The first thing for me is ...

HPWM max frequency with PBP is ...32767 Hz ...

so, 40 Khz need to use the PWM module " hand configured " .


The second one is ...

DT Interrupts handles by itself the interrupt enable and disable ... as you answered YES for resetFlag ...


The Third one is ...

I would stop TMR1 as it continues to run ... first, to read it comfortably, and second, to avoid a timer overflow ... note you'll have to reset it somewhere ... sooooo ... HAVE to stop it !!!

Alain