forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Closed
Copy link
Description
This only works on even pins, the rest are left low judging by LEDs on a Cytron Maker Pi Pico I've been using:
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
>>> import pwmio
>>> import board
>>> pins = (board.GP0, board.GP1, board.GP2, board.GP3,
... board.GP4, board.GP5, board.GP6, board.GP7,
... board.GP8, board.GP9, board.GP10, board.GP11,
... board.GP12, board.GP13, board.GP14, board.GP15)
>>> pwms = [pwmio.PWMOut(p, frequency=2000, duty_cycle=3456) for p in pins]
If the odd pins are initialised first then only those work.
>>> pwms_o = [pwmio.PWMOut(pins[p_idx], frequency=2000, duty_cycle=3456) for p_idx in range(1, len(pins), 2)]
>>> pwms_e = [pwmio.PWMOut(pins[p_idx], frequency=2000, duty_cycle=3456) for p_idx in range(0, len(pins), 2)]
Based on some discussions it sounds like the hardware is capable of 16 especially if the frequency values are all the same.
Tested on 6.2.0-beta.2
and 6.2.0-beta.2-18-g2a467f137 on 2021-02-15
.
Originally mentioned in #4167 as I wasn't sure if this was a bug although having said that CP normally gives an instantiation error if it's run out of PWM things.
Curiously, #4208 shows that the consecutive pair GP18 and GP19 can both do PWM using PWMAudioOut
.