Teensy 4.0 PWM

Status
Not open for further replies.

Bonnom

New member
I want to use PWM on the teensy 4.0, this is going to replace the older Teensy 3.2 in my project. For the other Teensy boards there is an excellent page about PWM https://www.pjrc.com/teensy/td_pulse.html.
Does someone have more information about the Teensy 4.0 PWM analogWriteFrequency() function? I want to know the frequencies and what pins are part of the same PWM group

Hopefully the PWM page will be updated soon!
 
I want to use PWM on the teensy 4.0, this is going to replace the older Teensy 3.2 in my project. For the other Teensy boards there is an excellent page about PWM https://www.pjrc.com/teensy/td_pulse.html.
Does someone have more information about the Teensy 4.0 PWM analogWriteFrequency() function? I want to know the frequencies and what pins are part of the same PWM group

Hopefully the PWM page will be updated soon!

There is a picture of the card that comes with the T4 here
HTML:
https://www.pjrc.com/store/teensy40.html
PWM pins are labeled in pink.
 
Here's the info from pwm.c.

If the first 3 of 5 numbers are the same, you can expect those pins to have the same frequency.

Internally the FlexPWM and QuadTimers have a total of 32 counters, so many different frequencies are possible.

Code:
        {1, M(1, 1), 0, 4},  // FlexPWM1_1_X   0  // AD_B0_03
        {1, M(1, 0), 0, 4},  // FlexPWM1_0_X   1  // AD_B0_02
        {1, M(4, 2), 1, 1},  // FlexPWM4_2_A   2  // EMC_04
        {1, M(4, 2), 2, 1},  // FlexPWM4_2_B   3  // EMC_05
        {1, M(2, 0), 1, 1},  // FlexPWM2_0_A   4  // EMC_06
        {1, M(2, 1), 1, 1},  // FlexPWM2_1_A   5  // EMC_08
        {1, M(2, 2), 1, 2},  // FlexPWM2_2_A   6  // B0_10
        {1, M(1, 3), 2, 6},  // FlexPWM1_3_B   7  // B1_01
        {1, M(1, 3), 1, 6},  // FlexPWM1_3_A   8  // B1_00
        {1, M(2, 2), 2, 2},  // FlexPWM2_2_B   9  // B0_11
        {2, M(1, 0), 0, 1},  // QuadTimer1_0  10  // B0_00
        {2, M(1, 2), 0, 1},  // QuadTimer1_2  11  // B0_02
        {2, M(1, 1), 0, 1},  // QuadTimer1_1  12  // B0_01
        {2, M(2, 0), 0, 1},  // QuadTimer2_0  13  // B0_03
        {2, M(3, 2), 0, 1},  // QuadTimer3_2  14  // AD_B1_02
        {2, M(3, 3), 0, 1},  // QuadTimer3_3  15  // AD_B1_03
        {0, M(1, 0), 0, 0},
        {0, M(1, 0), 0, 0},
        {2, M(3, 1), 0, 1},  // QuadTimer3_1  18  // AD_B1_01
        {2, M(3, 0), 0, 1},  // QuadTimer3_0  19  // AD_B1_00
        {0, M(1, 0), 0, 0},
        {0, M(1, 0), 0, 0},
        {1, M(4, 0), 1, 1},  // FlexPWM4_0_A  22  // AD_B1_08
        {1, M(4, 1), 1, 1},  // FlexPWM4_1_A  23  // AD_B1_09
        {1, M(1, 2), 0, 4},  // FlexPWM1_2_X  24  // AD_B0_12
        {1, M(1, 3), 0, 4},  // FlexPWM1_3_X  25  // AD_B0_13
        {0, M(1, 0), 0, 0},
        {0, M(1, 0), 0, 0},
        {1, M(3, 1), 2, 1},  // FlexPWM3_1_B  28  // EMC_32
        {1, M(3, 1), 1, 1},  // FlexPWM3_1_A  29  // EMC_31
        {0, M(1, 0), 0, 0},
        {0, M(1, 0), 0, 0},
        {0, M(1, 0), 0, 0},
        {1, M(2, 0), 2, 1},  // FlexPWM2_0_B  33  // EMC_07
        {1, M(1, 1), 2, 1},      // FlexPWM1_1_B  34  // SD_B0_03
        {1, M(1, 1), 1, 1},      // FlexPWM1_1_A  35  // SD_B0_02
        {1, M(1, 0), 2, 1},      // FlexPWM1_0_B  36  // SD_B0_01
        {1, M(1, 0), 1, 1},      // FlexPWM1_0_A  37  // SD_B0_00
        {1, M(1, 2), 2, 1},      // FlexPWM1_2_B  38  // SD_B0_05
        {1, M(1, 2), 1, 1},      // FlexPWM1_2_A  39  // SD_B0_04
 
One small note...
the documentation could be updated regarding pwm frequency, whether the analogWriteFrequency() function is valid for Teensy 4.0/4.1 ( I guess it is due to this thread but the doc made me wondering at first.)
:)
 
One small note...
the documentation could be updated regarding pwm frequency, whether the analogWriteFrequency() function is valid for Teensy 4.0/4.1 ( I guess it is due to this thread but the doc made me wondering at first.)
:)

Is this linked page where the doc needs an update: pjrc.com/threads/60862-Web-site-could-use-a-few-updates-)
>>"Teensy LC & 3.x support the analogWriteFrequency(pin, frequency) function to easily configure the PWM."

Everything else on that page up to date and it works the same with noted details including the T_4.x

If something else misled - post on that "Web-site-could-use-a-few-updates" thread.
 
Ok.. thanks... will do next time...

:cool: ... Just wanted to be sure it covered the issue as observed. That 'updates' thread is hard to find, have to search "web site" not "website" even when you "KNOW" that thread exists :(

That "Freq" just came up last week when that post was made. So many other details exacting and perfect ... and that one line leaves the reader hanging ... :)
 
Status
Not open for further replies.
Back
Top