No, only the two TPM timers have quadrature capability.My guess is that it does support more than 2, between the FTM timers and the TPM timers
Sorry I have not double checked how all of the things interact. Here is/was my guessing.No, only the two TPM timers have quadrature capability.
Optical encoder sounds like you will have a clean signal. 1MHz should be very doable with optimized interrupt code. However, if any other code disables interrupts even for a relatively short time, you will loose ticks.I'm developing a digital readout for optical encoders (lathes, mills and precision measurement systems) and would like to get about 1 MHz count frequency. My current software solution is good for about 200MHz (4 counters) which is good enough for lathes and mills. For high precission gauges with 0.25µm/step 250khz is somwhat limited.
It is supposed to be a low cost replacement of commercially available DRO's which you can get for about $100. Two teensies would probably be too expensive.Maybe use two Teensy 3.2s?
Hm, 4 encoders each generating interupts at a frequency of about 1 MHz sounds like overloading a T3.2. Additionally to doing the counting it has to run a webserver and maintain a websocket connection to get the data to the display. But I'll try that with a T3.6 as soon as it is available.1MHz should be very doable with optimized interrupt code. However, if any other code disables interrupts even for a relatively short time, you will loose ticks.
You are right. I did a bit of testing, a 1MHz interrupt rate seems to be about the absolute maximum the Teensy can handle. The USB serial console stops working reliably at around 300'000 interrupts per second (I gave my interrupt the highest priority).Hm, 4 encoders each generating interupts at a frequency of about 1 MHz sounds like overloading a T3.2.
typedef uint32_t buffer_t[256];
volatile buffer_t buffer;
volatile uint8_t buffer_idx = 0;
volatile uint32_t counter = 0;
FASTRUN void ftm1_isr(void) {
uint32_t sc = FTM1_SC;
if (sc & 0x80) FTM1_SC = sc & 0x7F;
buffer[buffer_idx] = GPIOC_PDIR;
buffer_idx++;
counter++;
}