Skip to content

Dead speakers due to SWJ release failure #51

Description

@Chase-san

For whatever reason the STM never disables SWJ debug interface during running, preventing PA_EN from going high and preventing the speakers from working.

Symptoms

  • Both speakers completely silent from first boot.
  • Headphone jack works normally.
  • Volume wheel has no effect on speakers.

Hardware / Firmware

  • PicoCalc
  • Pico2W
  • Picocalc BIOS v1.4, v1.6 (likely older as well)

Test Progression

  1. Clean PicoMite install produces audio at the jack. So PWM (GP26/27), filter, and volume pot are good.
  2. HP_DET at the R507/R508 node: ~0 V unplugged, ~3.2 V plugged, so the jack detect switch works.
  3. Speakers verified working when driven directly from an external source.
  4. AW8010 output pads read 0 V (high-Z). So that means the amps never enable.
  5. STM32 pin 49 (PA14 / PA_EN) stays low even with firmware modified to write it HIGH every 10 ms. Reflowing pins 49–53 changed nothing.
  6. I noticed while testing that pin 50 (PA15) sits solidly high with nothing driving it. PA15 is JTDI, which has an internal pull-up only while the JTAG/SWD matrix owns the pin. PA14 is SWCLK (internal pull-down). PA13 is SWDIO (internal pull-up). Which is why PICO_EN is high and the Pico boots anyway.
  7. Bridging pin 49 to pin 50 (JTDI pull-up vs SWCLK pull-down) raises PA_EN above the AW8010 EN threshold causing the speakers to work.
  8. Firmware patched to explicitly write AFIO->MAPR SWJ_CFG = 100 (JTAG+SWD disabled) and reconfigure PA14 which lets the speakers work with no hardware modification.

Cause and Fix

On the chip I have in my PicoCalc the implicit SWJ release performed by the Arduino core during pinMode(PA13/PA14, ...) does not take effect, so PA13/PA14/PA15 remain owned by the debug interface. PA14 (PA_EN) is therefore held low by SWCLK's internal pull-down and firmware GPIO writes never reach the pin. A direct/explicit SWJ_CFG write works however.

In picocalc_keyboard.ino, force the release explicitly:

// in setup(), before any PA13/PA14 pinMode:
__HAL_RCC_AFIO_CLK_ENABLE();
__HAL_AFIO_REMAP_SWJ_DISABLE();

// In check_hp_det(), re-assert each poll:
__HAL_AFIO_REMAP_SWJ_DISABLE();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions