-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Issue with direct PCIe mapping approach
Hey! Really cool project idea. I've been looking at your schematic and the SD Express specs, and I think there's going to be an issue with the direct wire-to-wire PCIe approach.
The problem
I've actually seen people try this exact same thing before and it doesn't work with real SD Express hosts. The issue is that the M.2 SSD can't directly respond to the SD Express initialization sequence that the Switch 2 expects.
How SD Express card initialization works
According to the SD Express Design Guide (check out Figure 11 on page 13), here's what happens from the card side:
- Host starts with regular SD protocol on CMD/CLK/DAT lines
- Card must respond to CMD0, CMD8, and other SD initialization commands
- In CMD8 response, card tells host "yes, I support PCIe mode"
- Host enables VDD2 (1.8V) power after seeing PCIe support
- Card detects VDD2 and switches its internal mux to PCIe mode
- Then PCIe communication starts on the DATA lines
Why direct M.2 connection won't work
With your current approach:
- Switch 2 sends CMD8 over SD protocol expecting SD card responses
- M.2 SSD has no idea what SD commands are - it only speaks PCIe/NVMe
- Switch 2 gets garbage/no response and thinks the card is broken
- VDD2 power never gets enabled, so M.2 SSD stays off
The M.2 SSD expects to see PCIe REFCLK and proper PCIe initialization, but the Switch 2 won't provide that until after the SD handshake completes.
The solution
You need a microcontroller on the card side to emulate an SD Express card during initialization. Here's what it needs to do:
During SD mode (first few milliseconds):
- Respond to SD commands (CMD0, CMD8, ACMD41, etc.) like a real SD card
- Tell the host "yes, I support PCIe" in the CMD8 response
- Wait for VDD2 power to be enabled by the host
After VDD2 comes online:
- Switch the mux to connect DAT0/1/2/3 directly to PCIe lanes
- Connect REFCLK to the M.2 SSD
- Assert PERST# to start M.2 initialization
- Get out of the way and let M.2 and Switch 2 talk directly
Additional hardware needed:
- Small MCU (STM32, RP2040, etc.)
- Mux control logic (similar to what you have)
- Basic SD protocol implementation (~100 lines of code)
The SD card emulation is actually pretty minimal - you only need to handle the basic initialization commands before switching over to PCIe passthrough mode.
Why I'm mentioning this
I'd love to work on this myself but don't have a Switch 2 or the bandwidth for a full hardware project right now. But I'm happy to help with:
- MCU firmware for SD card emulation
- SD protocol implementation details
- Code review and debugging
- General technical discussion
Your PCIe routing and M.2 connector selection looks solid, it just needs that SD card personality during the first part of initialization.
References
- SD Express Host Implementation Guide - Figure 11 on page 13 shows the card-side initialization flow
- SD Physical Layer Specs - Simplified version 7.10 has the command details for card implementation
The good news is this doesn't really complicate the design much, and you can test the SD emulation part with any SD reader before even touching the Switch 2.