Skip to content

Varying duty_cycle on PWMOut very occasionally results in a high blip #1644

Open
@kevinjwalters

Description

@kevinjwalters

I've been using PWMOut for audio use and I heard a few anomalies on 4.0.0-beta.3. I've looked into it briefly and it appears that very occasionally there's a high blip on my PWM. @deshipu asked if it's one cycle on Discord and I think it is although it's difficult to tell on my traditional (non storage) oscilloscope. It can be recreated with this code on a Circuit Playground Express (CPX):
[EDIT by dhalbert to update example to use pwmio]

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-beta.3 on 2019-03-07; Adafruit CircuitPlayground Express with samd21g18
>>> import board, pulseio, time
>>> p6 = pwmio.PWMOut(board.A6, duty_cycle=32768, frequency=100, variable_frequency=True)
>>> while True:
...     for i in range(4096, 28672, 1000):
...         p6.duty_cycle = i
...         time.sleep(0.1)
...     for i in range(28672, 4096, -1000):
...         p6.duty_cycle = i
...         time.sleep(0.1)

If you watch the square wave for about 30 seconds you're likely to see one or two.

I tried same thing on board.A1 and watched it for a few minutes and I've not seen any problem there.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions