Skip to content

shims: let the transceiver boot before clocking SPI - #4

Open
ericrwx wants to merge 1 commit into
MorseMicro:mainfrom
ericrwx:fix-reset-settle-delay
Open

shims: let the transceiver boot before clocking SPI#4
ericrwx wants to merge 1 commit into
MorseMicro:mainfrom
ericrwx:fix-reset-settle-delay

Conversation

@ericrwx

@ericrwx ericrwx commented Jul 28, 2026

Copy link
Copy Markdown

Problem:

mmhal_wlan_hard_reset() waited 20ms after releasing RESET_N. That covers the reset pulse but not the transceiver's boot, and the SD over SPI startup handshake begins clocking as soon as it returns: a training sequence, then a poll for the command response, well over a thousand clock edges. A transceiver that is still booting can latch onto a bit phase that is not byte aligned with the host's framing and hold it for the rest of the boot.

The symptom is misleading. Every SPI transfer succeeds and the response itself is intact, just offset by a few bit periods, so the driver rejects it as an invalid ack and the failure presents as absent or faulty hardware. It is intermittent, and more likely on boards where concurrent activity delays the handshake relative to the reset.

Fix:

Wait CONFIG_MM_RESET_SETTLE_MS before the first clock edge instead. This is Kconfig rather than a constant because the delay a board needs depends on its transceiver and firmware image, so a board with a known boot time can tune it up or down.

@ericrwx
ericrwx force-pushed the fix-reset-settle-delay branch 2 times, most recently from bcbad63 to 87350fb Compare July 28, 2026 21:28
Comment thread halow/components/shims/mmhal_wlan.c Outdated
mmhal_wlan_hard_reset() waited 20ms after releasing RESET_N. That covers
the reset pulse but not the transceiver's boot, and the SD over SPI startup
handshake begins clocking as soon as it returns: a training sequence, then
a poll for the command response, well over a thousand clock edges. A
transceiver that is still booting can latch onto a bit phase that is not
byte aligned with the host's framing and hold it for the rest of the boot.

The symptom is misleading. Every SPI transfer succeeds and the response
itself is intact, just offset by a few bit periods, so the driver rejects
it as an invalid ack and the failure presents as absent or faulty hardware.
It is intermittent, and more likely on boards where concurrent activity
delays the handshake relative to the reset.

Wait CONFIG_MM_RESET_SETTLE_MS before the first clock edge instead. This is
Kconfig rather than a constant because the delay a board needs depends on
its transceiver and firmware image, so a board with a known-shorter boot
can tune it down.

The 20ms default is unchanged for backwards compatibility, but systems that
need a longer duration can now override this. For example, on an ESP32-C5
with an MM8108, boots failed at 20ms and were clean from 30ms upward; a
reset settle delay of 100ms would provide a safe margin to ensure
successful transceiver boot.

Signed-off-by: Eric Wang <eric@rwx.one>
@ericrwx
ericrwx force-pushed the fix-reset-settle-delay branch from 87350fb to 243f91a Compare July 30, 2026 01:27
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.

2 participants