Skip to content

PWMAudioOut audio output uses last pins set even if code is changed on nRF52840 #4453

@kevinjwalters

Description

@kevinjwalters

I was just playing some audio on a Feather nRF52840 and changed the code from stereo to mono and I could still see the audio was active on the right_channel. I could see on the serial console that it was doing Auto-reload but I verified code.py had actually changed. I did a microcontroller.reset() and then it was actually using the pins I defined. I'm just watching audio on LEDs so not sure if samples will then play on both channels but there was certainly activity on right_channel when there should not have been.

This is on 6.1.0.

import board
from audiocore import WaveFile
try:
    from audioio import AudioOut
except ImportError:
    from audiopwmio import PWMAudioOut as AudioOut

stereo=True   ### change this to False
AUDIO_PIN_L = board.A0
AUDIO_PIN_R = board.A1
if stereo:
    audio_out = AudioOut(AUDIO_PIN_L)
                         right_channel=AUDIO_PIN_R)
else:
    audio_out = AudioOut(AUDIO_PIN_L)

You need to actually play a sample to get the PWM outputs to light up.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions