PWM frequency



  • I'm a little confused by the documentation.
    It states that pwm = PWM(0, frequency=5000) # use PWM timer 0, with a frequency of 50KHz will generate a PWM object with a frequency of 50 kHz. Further down the docs state that:

    frequency is an integer from 1 to 19455 Hz.

    I need the frequency to be 25 kHz, is this possible with the Wipy or Lopy?



  • @RobTuDelft The comment in the example is wrong. Maximum is 19455. For an input value between 19456 and 19531 you'll get 19531 Hz. Generally, the precision is low at the higher frequencies. So specifying a value of 19000 give 19011 Hz, 19200 -> 19230. So it looks as if the "real" periods are multiples of a small value like 200 ns.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.