-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Hello,
I am running the sdio core on a Nexys A7 (Artix-7) with MicroBlaze (bare-metal, no OS). I have OPT_CARD_DETECT = 1 enabled in both scenarios described below.
I observed a critical difference in behavior based on how the i_card_detect port is driven:
Scenario A (Working): i_card_detect is tied to a Constant 1 in the Block Design.
Result: Initialization works perfectly. ACMD41 returns Ready (0xC1FF8000).
Scenario B (Failing): i_card_detect is connected to the physical CD pin (via a NOT gate to ensure Active High).
Result: CMD8 works, but ACMD41 returns BUSY (0x00FF8000) indefinitely.
I verified the polarity is correct (High when inserted). Debug prints show the core receiving the signal correctly (PRESENTN and REMOVED bits toggle as expected).
It seems the internal state machine gets stuck in a Busy state when dealing with the real pin, whereas a Constant 1 bypasses this issue.
Logs (Scenario B - Failing with Real Pin):
PHY=C99C00FC SERDES=00000000 DDR=00000001
idle cmd=00004040 removed=0
idle cmd=00004040 presentn=0
CMD0: SEND_GO_IDLE
Cmd: 00000040
Data: 00000000
after idle cmd=00000040 removed=0
after idle cmd=00000040 presentn=0
[CMD8] pre sd_phy=C99000FC
CMD8: SEND_IF_COND (000001A5)
Cmd: 00010108
Data: 000001A5
after ifcond cmd=00000040 removed=0
after ifcond cmd=00000040 presentn=0
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 00000000
Cmd: 0022813F
Data: 00FF8000
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 51FF8000
Cmd: 0022813F
Data: 00FF8000
[ACMD41] i=00000001 ocr=00FF8000 cmd=0022813F removed=00000000 presentn=00000000
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 51FF8000
Cmd: 0022813F
Data: 00FF8000
. . .
. . .
. . .
Logs (Scenario A - Working with Constant 1)
PHY=C99C00FC SERDES=00000000 DDR=00000001
CMD0: SEND_GO_IDLE
Cmd: 00000040
Data: 00000000
[CMD8] pre sd_phy=C99000FC
CMD8: SEND_IF_COND (000001A5)
Cmd: 00010108
Data: 000001A5
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 00000000
Cmd: 0022813F
Data: 00FF8000
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 51FF8000
Cmd: 0022813F
Data: 00FF8000
CMD55: SEND_APP_CMD
Cmd: 00010137
Data: 00000120
ACMD41: SEND_OP_COND : 51FF8000
Cmd: 0022813F
Data: C1FF8000
READ-OCR: OCR = C1FF8000
. . .
. . .
I also added a debouncer module before the sdio module but I observed still the same behavior.
Is there a specific requirement for the i_card_detect signal that I might be missing?
Thanks.