Setup:
- eMMC HS400-DS, 8-bit DDR,
OPT_SERDES, OPT_CRCTOKEN=1, i_cfg_expect_ack=1
- 100 MHz controller clock, SanDisk iNAND 7550
- the code below is unmodified upstream, identical in master (
rtl/sdtxframe.v) and dev
(rtl/sdio/sdtxframe.v), same line numbers
Every multi-block DMA write at ckspd==1 aborts within about 2 ms. sd_cmd reads 0x0501930c,
so bit24 dma_error is set and bit23 r_ecode is 0, i.e. ercode 2'b10, a timeout rather than
a NAK. CMD13 afterwards shows the card in rcv with no error bits. The same writes work at
ckspd==0.
The card is acking normally. ILA on i_ds shows exactly 5 DS posedges after the block and then
a hold, which is the 5-bit status token and matches atok_sreg self-stopping after 5 shifts of
00101. i_dma_err and i_cmd_err are 0 in every sample of the window, so i_tx_err is the
only term that can satisfy the abort equation in sdaxil.v.
We probed the delay from tx_valid falling (the event that reloads r_timeout) to i_crcack.
It is 15 controller clocks at ckspd==1 and 9 at ckspd==0. r_timeout (:135) reloads to 15
(:939) and errors at r_timeout <= 1 (:978), so the window is 14, and 100 MHz misses it by
one clock.
In HS400-DS the token rides the card's DS strobe, so besides N_CRC and the 5 token bits the
host also pays the clock-out/DS-in round trip and the two-flop DS to i_clk sync in
sdfrontend. Only the card-clock part of that scales: at ckspd==1 one i_ckstb is one card
clock, at ckspd==0 it is two. We have only measured those two speeds.
Separately, at :978 the timeout is scored against r_ackd, but r_ackd only latches on the
next edge (:968). If the token lands on the cycle the timeout expires, i_crcack is already
high at the input and the error still wins.
Our fix, if the shape looks right we can send a PR:
- widen
r_timeout to [5:0] and reload (i_cfg_expect_ack) ? CRCTOKEN_TIMEOUT : 6'd15, with
CRCTOKEN_TIMEOUT a parameter defaulting to 63, so only the expect-ack wait lengthens and
o_done's minimum quiet window is unchanged
- add
&& !i_crcack && !i_crcnak at :978 so a same-cycle token wins
100 MHz writes have worked since, and nothing gets slower because r_done still fires on the
ack. We also have a small testbench that drives sdtxframe through a 512 B block at ckspd==1
and sweeps the ack arrival time. Against unmodified upstream it accepts an ack at 14 controller
clocks and rejects 15. Happy to post it.
Is 15 i_ckstb meant to be a fixed budget, or should it scale with i_cfg_spd? A DS-strobed
token seems to cost more than the SDR path it was sized for, and it is invisible at every speed
except ckspd==1.
Setup:
OPT_SERDES,OPT_CRCTOKEN=1,i_cfg_expect_ack=1rtl/sdtxframe.v) and dev(
rtl/sdio/sdtxframe.v), same line numbersEvery multi-block DMA write at
ckspd==1aborts within about 2 ms.sd_cmdreads0x0501930c,so bit24
dma_erroris set and bit23r_ecodeis 0, i.e. ercode2'b10, a timeout rather thana NAK. CMD13 afterwards shows the card in
rcvwith no error bits. The same writes work atckspd==0.The card is acking normally. ILA on
i_dsshows exactly 5 DS posedges after the block and thena hold, which is the 5-bit status token and matches
atok_sregself-stopping after 5 shifts of00101.i_dma_errandi_cmd_errare 0 in every sample of the window, soi_tx_erris theonly term that can satisfy the abort equation in
sdaxil.v.We probed the delay from
tx_validfalling (the event that reloadsr_timeout) toi_crcack.It is 15 controller clocks at
ckspd==1and 9 atckspd==0.r_timeout(:135) reloads to 15(
:939) and errors atr_timeout <= 1(:978), so the window is 14, and 100 MHz misses it byone clock.
In HS400-DS the token rides the card's DS strobe, so besides
N_CRCand the 5 token bits thehost also pays the clock-out/DS-in round trip and the two-flop DS to
i_clksync insdfrontend. Only the card-clock part of that scales: atckspd==1onei_ckstbis one cardclock, at
ckspd==0it is two. We have only measured those two speeds.Separately, at
:978the timeout is scored againstr_ackd, butr_ackdonly latches on thenext edge (
:968). If the token lands on the cycle the timeout expires,i_crcackis alreadyhigh at the input and the error still wins.
Our fix, if the shape looks right we can send a PR:
r_timeoutto[5:0]and reload(i_cfg_expect_ack) ? CRCTOKEN_TIMEOUT : 6'd15, withCRCTOKEN_TIMEOUTa parameter defaulting to 63, so only the expect-ack wait lengthens ando_done's minimum quiet window is unchanged&& !i_crcack && !i_crcnakat:978so a same-cycle token wins100 MHz writes have worked since, and nothing gets slower because
r_donestill fires on theack. We also have a small testbench that drives
sdtxframethrough a 512 B block atckspd==1and sweeps the ack arrival time. Against unmodified upstream it accepts an ack at 14 controller
clocks and rejects 15. Happy to post it.
Is 15
i_ckstbmeant to be a fixed budget, or should it scale withi_cfg_spd? A DS-strobedtoken seems to cost more than the SDR path it was sized for, and it is invisible at every speed
except
ckspd==1.