I received a MIMXRT1170-EVK from Mouser in May of 2021. Eval board had NAND chip and 6-axis e-compass (3-axis mag, 3-axis accel) sensor, FXOS8700CQ sensor. Powering on board, it is running bubble program (NXP SDK)...
The mask for the C/D FLEXPWM timers is ALT 2 (ref page 515)
*(portConfigRegister(ChannelC)) = 2;//Maske;
*(portConfigRegister(ChannelD)) = 2;//Maske;
See https://www.nxp.com/docs/en/application-note/AN4485.pdf ...
my T4 micromod (7/13/21) and ATP carrier show all ATP edge pins are good. I just probed ATP pins with GND wire and this Loop()
void loop() {
for (int j = 0; j < MM_PINS; j++) {
if (digitalRead(j) == 0)...
It is common practice to use TCF1EN. if you choose to use TCFIE, then in the ISR you need clear the TCF bit
TMR4_SCTRL2 &= ~(TMR_SCTRL_TCF);.
If you don't clear the TCF (or TCF1) bit in the ISR, the interrupt will be...
Why not just use Teensy hardware PWM and avoid the ISR overhead all together ?? Here is sketch that generates 23 hz on pin 11 at 80% duty
void setup() {
analogWriteFrequency(11, 23.44);
analogWrite(11, 205); //...
The Teensy 4 PWM can generate a square-wave (without CPU intervention). The PWM frequencies are discrete divisors of 150 mhz. so you can't get exactly 24mhz. Try this in setup()
analogWriteFrequency(23,24000000);
...
Hmmm, If the FTM timer is ticking at 4 MHz, then to generate a data pulse will require a tick to generate a HIGH bit and then a tick for a LOW bit, so the data rate for galvanometer data will be 2 Mhz. Or 10 us for...
Re: a better fix?
A better solution is to remove the if(txPing & 2) logic from the isr in the library, so the dma.sourceBuffer() is executed on every DMA ISR.
// if(txPing & 2) {
// txPing &= ~2;
if(txPing...
here is sketch that demonstrates using TPM2/DMA to set the lower 8 PORTD bits on Teensy LC (tested with scope on PORTD pins)
// PORTD pins 2 14 7 8 6 20 21 5 TPM2
#include <DMAChannel.h>
#define PRREG(x)...