Here's what my code is doing:
- Code: Select all
// Full reset, wait until the reset bit is cleared.
*EMMC_CONTROL0 = 0;
*EMMC_CONTROL1 = C1_SRST_HC;
*EMMC_CONTROL2 = 0;
while( *EMMC_CONTROL1 & C1_SRST_HC );
// Set the clock - I've tried including various values for the divider...
*EMMC_CONTROL1 = C1_CLK_EN | C1_CLK_INTLEN;
while( !(*EMMC_CONTROL1 & C1_CLK_STABLE) );
// Enable interrupts for errors which occur during setup commands.
*EMMC_IRPT_EN = INT_CMD_COMPLETE_MASK;
*EMMC_IRPT_MASK = INT_CMD_COMPLETE_MASK;
// Send GO_IDLE_STATE command
*EMMC_INTERRUPT = 0;
*EMMC_ARG1 = 0;
*EMMC_CMDTM = 0 << 24; // GO_IDLE_STATE = index 0, I know, shift does nothing
// Wait for some sort of response.
while( !(*EMMC_INTERRUPT & INT_CMD_COMPLETE_MASK) );
After doing this, what I see in the RESP0 register is the value 0, when its supposed to be 1. The rest, i.e. waiting for the command to complete, appears at least to work fine.
What I'm not certain about is:
1) what's the actual int value that should be written to CMDTM for CMD0?
2) should the command value include the CMD_RSPNS_TYPE flag (10)? If I include that when I set the command I get a timeout error in the interrupt register...
3) Is the reset/clock part necessary? What divider value should I be using? Is there any additional setup code I'm missing?
4) Should I be looking in RESP0 or RESP3? RESP3 seems to have values in it which change somewhat depending on how I mess with the code above - the high byte is either 0x05 or 0x07...
Thanks for any help in advance