Skip to content

PWMOut does not work after a pin has been used with AnalogIn on nRF52840 #3313

@kevinjwalters

Description

@kevinjwalters

This example is from a CLUE running 5.3.0

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840
>>> import pulseio, board
>>> p0out = pulseio.PWMOut(board.P0, frequency=50, duty_cycle=0, variable_frequency=True)
>>> p0out.duty_cycle = 32768  ### good
>>>
>>>
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 239, in <module>
KeyboardInterrupt:



Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840
>>> import board, analogio
>>> p0in = analogio.AnalogIn(board.P0)
>>> (p0in.value, p0in.value, p0in.value, p0in.value, p0in.value)
(656, 0, 368, 240, 208)
>>> p0in.deinit()
>>> p0in = None
>>> import pulseio
>>> import pulseio
>>> p0out = pulseio.PWMOut(board.P0, frequency=50, duty_cycle=0, variable_frequency=True)
>>> p0out.duty_cycle = 32768  ### Nothing, stays at 0v

I'm checking ouput on a 'scope. I see the first PWM, but not the second one, something about the brief use of AnalogIn is defeating it.

I'm not running 5.3.1 but see nothing in release notes about work in this area.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions