gregwa
Posts: 36
Joined: Tue Feb 02, 2021 10:15 am

PWM does not work on any recent nightly build but does on original 1.20

Mon May 29, 2023 12:09 am

I have a program that was working fine on 1.20 original. It was driving two motors using a dual motor controller that uses PWM to set speed.

Works under Original 1.20. No changes to hardware, or code, nothing happens on when using 1.20-117 on either Pico or Pico-W.

I've reported it on the micropython board (https://github.com/orgs/micropython/discussions).

Just wanted to give everyone a heads up.

Gregwa

gregwa
Posts: 36
Joined: Tue Feb 02, 2021 10:15 am

Re: PWM does not work on any recent nightly build but does on original 1.20

Mon May 29, 2023 9:54 am

I got a response from the Micropython group this morning.

I appears that versions of Micropython previous to the new nightly builds (including 1.20 original) did not require a frequency during the init or anywhere else.

Now it does. This allows the RP2 port to be consistent with other ports.

So, if you are having issues with ppm, when you declare the PWM pins include a freq=XXXXX parameter.

Code: Select all

self.M1A = machine.PWM(machine.Pin(M1A),freq=1000)
I haven't given it anything other than a quick check, but it does seem to fix the problems.

Gregwa

Return to “MicroPython”