lancaster-university / codal-microbit-v2

CODAL target for the micro:bit v2.x series of devices
MIT License
43 stars 52 forks source link

Microbit + Micropython or MS MakeCode - setting analog period (analog frequency) on one pin affects other pins - same frequency on all pins #277

Closed lafar6502 closed 1 year ago

lafar6502 commented 1 year ago

Hi i have a problem with simple program on Micro:bit via Makecode blocks or Micropython editor

i'm trying to set up two different PWM frequencies on P1 and P2 pins by setting different analog period in microseconds however, every time the frequency ends up being the same on both pins and changing the analog period on one pin also changes the period on the other. No way to have different frequencies and when i output any value via servo APIs (in makecode blocks), even on unrelated pin (p0, for example), the frequency on all pins changes to about 50 Hz.

Is this an error or by design? I have reported this problem on MS pxt github, but the same behavior i can see when running micropython script so i decided to ask here. Microbit v2.21

https://github.com/microsoft/pxt-microbit/issues/4950

Best regards RG

lafar6502 commented 1 year ago

closing this - looks like all pwms on Microbit share the same frequency, and servo PWM uses the same timer/infrastructure