Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 4.0 PWM

  1. #1
    Junior Member
    Join Date
    Aug 2019
    Posts
    4

    Teensy 4.0 PWM

    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!

  2. #2
    Quote Originally Posted by Bonnom View Post
    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 Code:
    https://www.pjrc.com/store/teensy40.html
    PWM pins are labeled in pink.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,459
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •