Skip to content

Disable CircuitPlayground Bluefruit speaker by default #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tannewt opened this issue Nov 1, 2019 · 4 comments · Fixed by #2262
Closed

Disable CircuitPlayground Bluefruit speaker by default #2258

tannewt opened this issue Nov 1, 2019 · 4 comments · Fixed by #2262

Comments

@tannewt
Copy link
Member

tannewt commented Nov 1, 2019

We need to disable the speaker on the CircuitPlayground Bluefruit just like we do on the Express because it currently makes noise when the AUDIO pin is touched.

@jepler
Copy link

jepler commented Nov 1, 2019

A little quick analysis: It looks like the related code in the samd port for the express version is:

    #ifdef SPEAKER_ENABLE_PIN
    speaker_enable_in_use = false;
    gpio_set_pin_function(SPEAKER_ENABLE_PIN->number, GPIO_PIN_FUNCTION_OFF);
    gpio_set_pin_direction(SPEAKER_ENABLE_PIN->number, GPIO_DIRECTION_OUT);
    gpio_set_pin_level(SPEAKER_ENABLE_PIN->number, false);
    #endif

(reset_all_pins)
and a few other bits all gated by SPEAKER_ENABLE_PIN. Similar code will need to be adapted into the nRF port, and SPEAKER_ENABLE_PIN provided/defined.

@kevinjwalters
Copy link

kevinjwalters commented Nov 1, 2019

How are you observing the noise and why is it problematic? Is this on VBUS and VCC or is this also making RFI? Specifically, I'm assuming this is actually the joy of class D amps and is coming from the PAM8301?

Ah, perhaps when you say noise this is just hearing audible noise from the 7.5mm speaker?

@tannewt
Copy link
Member Author

tannewt commented Nov 1, 2019

Yup, just hear it out of the speaker when I touch the audio pad. It's not the end of the world but it is unexpected.

@kevinjwalters
Copy link

I was interested in anything PAM8301 related because I somehow let the magic smoke out of mine with some rather innocent use, I added some notes to an existing thread: Adafruit Forums: Circuit Playground Express gets VERY hot.

jepler added a commit to jepler/circuitpython that referenced this issue Nov 1, 2019
This allows the board to disable the onboard speaker until explicitly
enabled in user code.

Testing performed on a CPB:
 * Touching the AUDIO pin with a fingertip no longer generates noise/buzz
 * Generating a waveform with `simpleio.tone` produces no sound by default
 * When the board.SPEAKER_ENABLE is configured as a digital output and
   set True, `simpleio.tone` does produce sound

Note that while guides should include information about SPEAKER_ENABLE, it's
possible that some users who omitted it could view this as a breaking change.
They can fix it by simply adding code similar to

    speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
    speaker_enable.direction = digitalio.Direction.OUTPUT
    speaker_enable.value = True

before using the internal speaker.

Closes: adafruit#2258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants