Reputation: 21
I am trying to set up pwm in raspberry pi pico using micropython. everything was ok until I set the frequency to 14,1,2,3,4,5,6,7,9. In these particular frequencies this error will raise: ValueError: freq too small this is my program:
from machine import Pin, PWM
led = PWM(Pin(25))
led.freq(14)
led.duty_u16(32512)
using different duty cycles and pins don't change the result. I tried an older firmware and the latest firmware and there was no difference.
I tried circuitpython on the same board and it worked with no problem in the specified frequencies.
Do you know any solution or reason for this problem?
Upvotes: 2
Views: 352
Reputation: 12633
I guess the allowed frequency for the Pico is 8Hz to 62.5MHz. So from your list of values (14,1,2,3,4,5,6,7,9
), both 9 and 14 should work fine.
Docs here: https://docs.micropython.org/en/latest/rp2/quickref.html#pwm-pulse-width-modulation
Upvotes: 0