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

Thread: Teensy 3.2 PWM

  1. #1
    Junior Member
    Join Date
    Mar 2017
    Posts
    1

    Teensy 3.2 PWM

    Hi all,

    I am currently doing a project that requires 12 bits of resolution and 5 channels of it. I want to use the teensy 3.2 because of its size and price. Can the 3.2 handle 5 pins at 12 bits resolution pwm?

  2. #2

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Yes, just use analogWriteResolution(12);

  4. #4

    Question But...

    What I don't see on this page, is, for instance, the 3.2 can do 16 bits resolution, with an "Ideal Frequency" at 96 MHz of 732.4218Hz. The default frequency of the PWM outputs is 488.28, no matter what the frequency of the processor clock. So does that mean that 16 bits will work at ANY frequency below the "Ideal"? If so, why is it labeled "Ideal" rather than "Maximum"? If not, and I can't use a frequency as high as 732.4218 Hz, does that mean I have to operator the processor at 72 MHz and set the master frequency to 549.3164 Hz? Or is there some way to calculate what frequencies will work with what resolutions given a specific processor clock?

  5. #5

    Question

    Quote Originally Posted by CoreyCoop View Post
    What I don't see on this page, is, for instance, the 3.2 can do 16 bits resolution, with an "Ideal Frequency" at 96 MHz of 732.4218Hz. The default frequency of the PWM outputs is 488.28, no matter what the frequency of the processor clock. So does that mean that 16 bits will work at ANY frequency below the "Ideal"? If so, why is it labeled "Ideal" rather than "Maximum"? If not, and I can't use a frequency as high as 732.4218 Hz, does that mean I have to operator the processor at 72 MHz and set the master frequency to 549.3164 Hz? Or is there some way to calculate what frequencies will work with what resolutions given a specific processor clock?
    It's been a year, with no response, so responding to this will hopefully put this to the top of the stack so someone might answer it, since again I am facing the same issue.

    Perhaps I was not clear: On a Teensy 3.2 I want to have pin 23 run at 16bits. The default frequency of the PWM is 488.28Hz, but the "ideal" frequency at 96MHz is 732.4218 Hz. The text only gives an example of a freqency that is faster than the "ideal", what happens if the frequency is slower, as in the example of using "analogWriteResolution(16)" without using "analogWriteFrequency(23, 732.4218)"?

    Obviously I will just do both, since that freqency is not a problem, but there are cases where it could be.

Posting Permissions

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