Skip to content

wifi: don't auto power down the transceiver when power save is disabled - #2681

Merged
Arisotura merged 1 commit into
melonDS-emu:masterfrom
dannyow:fix/wifi-sleepmode-powerdown
Jun 7, 2026
Merged

wifi: don't auto power down the transceiver when power save is disabled#2681
Arisotura merged 1 commit into
melonDS-emu:masterfrom
dannyow:fix/wifi-sleepmode-powerdown

Conversation

@dannyow

@dannyow dannyow commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #2680

dswifi in infrastructure mode runs with power saving disabled (W_MODE_WEPsleep mode 2), but arms the one-shot W_BeaconCount2 countdown at 0xFFFF TUs (≈67s) during init. SetIRQ13() exempted only sleep mode 3 from auto power-down, so when the countdown ran out the transceiver was powered off and since stations with power saving disabled don't service IRQ13/IRQ15, nothing ever woke it back up. All wifi traffic silently died ~67s after init.

This restricts the auto power-down to automatic power saving mode (0). Real hardware does not power down in mode 2 (verified with the repro ROM from the issue: dies at ~67s on melonDS, runs indefinitely on a real DS).

I wasn't sure whether mode 1 should also auto-sleep happy to adjust if the intended semantics are different.

Tested: repro ROM from #2680 on macOS, master build radio stays alive well past the 67s mark (>4 min soak); unpatched build dies on schedule.

…bled

sleep mode 2 ("power saving disabled", used by dswifi in infrastructure
mode) was treated like automatic mode: when the one-shot W_BeaconCount2
countdown armed at wifi init (0xFFFF TUs = ~67s) reached zero, IRQ13
powered the transceiver off. stations running with power saving disabled
never service IRQ13/IRQ15, so nothing ever turned it back on, silently
killing all wifi traffic ~67 seconds after init. real hardware does not
power down in this mode.
@dannyow dannyow changed the title wifi: don't auto power down the transceiver when power saving is disa… wifi: don't auto power down the transceiver when power save is disabled Jun 4, 2026
@AntonioND

Copy link
Copy Markdown
Contributor

I've created an issue in BlocksDS to investigate switching to automatic power saving mode: https://codeberg.org/blocksds/sdk/issues/379

@Arisotura

Copy link
Copy Markdown
Member

oh, good catch

@Arisotura
Arisotura merged commit 10a173b into melonDS-emu:master Jun 7, 2026
10 checks passed
Zection6V pushed a commit to ag-advania/melonPrimeDS that referenced this pull request Aug 13, 2026
…bled (melonDS-emu#2681)

sleep mode 2 ("power saving disabled", used by dswifi in infrastructure
mode) was treated like automatic mode: when the one-shot W_BeaconCount2
countdown armed at wifi init (0xFFFF TUs = ~67s) reached zero, IRQ13
powered the transceiver off. stations running with power saving disabled
never service IRQ13/IRQ15, so nothing ever turned it back on, silently
killing all wifi traffic ~67 seconds after init. real hardware does not
power down in this mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DS wifi silently dies ~67 seconds after init (dswifi / infra. mode)

3 participants