FreqMeasureMulti & analogWriteFrequency

Status
Not open for further replies.
Hi,

I am using a project where my main PCB has to support either Teensy LC and Teensy 3.2 boards. When I need CAN I use the 3.2, otherwise I use the LC.

I want to read in, 2 low frequencies (< 1KHz) and so I use FreqMeasureMulti on pin D6 and D9. So Far everything OK, for use with LC or 3.2

Now I want to use another output to generate a different frequency with different PWM if necessary.

On the LC
I use TimerOne on pin D17 or D16 which has another timer (FTM1) than D6 or D9 (FTM0).
This works fine.

On the 3.2
I can not use pin D17 or D16 because these are no PWM outputs on the 3.2 and I can not use D3 or D4 since I need them to read CAN signals

So the frequency output pin on the LC and 3.2 has to be a common pin because I want to use the same PCB main board.

My question is now can I read in a frequency on a digital pin with FreqMeasureMulti and use another digital pin with the same FTM Timer and use analogWriteFrequency to generate a desired frequency and pwm?

If yes, I could use for example the common D20, D22 or D23 pins with analogWriteFrequency on the LC and 3.2.

Thanks in advance,
 
My question is now can I read in a frequency on a digital pin with FreqMeasureMulti and use another digital pin with the same FTM Timer and use analogWriteFrequency to generate a desired frequency and pwm?

The answer is no.

FreqMeasureMulti configures the timer for a period of exactly 65536 F_BUS clocks. You can use the other channels of the same timer for PWM, but only at F_BUS/65536 frequency. If you use analogWriteFrequency(), the timer's period will be changed, causing FreqMeasureMulti to give wrong results.
 
The answer is no.

FreqMeasureMulti configures the timer for a period of exactly 65536 F_BUS clocks. You can use the other channels of the same timer for PWM, but only at F_BUS/65536 frequency. If you use analogWriteFrequency(), the timer's period will be changed, causing FreqMeasureMulti to give wrong results.

OK Paul, thank you for your clear and quick reply.
 
FreqMeasureMulti configures the timer for a period of exactly 65536 F_BUS clocks. You can use the other channels of the same timer for PWM, but only at F_BUS/65536 frequency. If you use analogWriteFrequency(), the timer's period will be changed, causing FreqMeasureMulti to give wrong results.

Ahh, good to know. Was wondering about this myself, maybe the github info page could be updated with this information for other people? Had to do some googling to find this out, luckily it just showed up a few days ago.

It's a little confusing since the FreqMeasure page has a "Hardware Requirements" table, seemingly implying that you can't use PWM on any pin that shares the same FTM as the measurement pin. So, I assumed that for freqMeasureMulti, if I used anything from FTM0, I would be down to only 2 PWM pins (via standard header interface).

Anyway, maybe adding a hardware requirements table would be useful for the freqMasureMulti page as well.

Thanks as always Paul!
 
The answer is no.

FreqMeasureMulti configures the timer for a period of exactly 65536 F_BUS clocks. You can use the other channels of the same timer for PWM, but only at F_BUS/65536 frequency. If you use analogWriteFrequency(), the timer's period will be changed, causing FreqMeasureMulti to give wrong results.

Paul,

Another questions about FreqMeasureMulti
Which are the pins that can be used with FreqMeasureMulti on Teensy 3.5 and 3.6 ?
Are this the FMT0 pins 5,6,9,10,20,21,22,23?
This is not mentioned on your website and neither on your GitHub README.


Kind Regards,

Jan
 
Status
Not open for further replies.
Back
Top