Hi All,
I'm trying to use the BeagleBone Blacks' eMMC as a FatFs storage device. I make the following initialization steps (after setting up all clocks and configuring the pins):
1) checking if the card is inserted (of course, it's soldered on the board ;) )
if(!m_pMmcd->IsCardInserted()) { return STA_NODISK; }
2) sending the init stream
if(!m_pMmcd->InitStreamSend()) { return STA_NOINIT; }
3) Going to Idle state by repeating cmd0 till the eMMC reports it's in Idle state.
// Go Idle State do { m_pMmcd->CommandSend(0, 0, 0, 0, false); bComplete = m_pMmcd->IsCmdComplete(0xFFFFFF); m_pMmcd->ResponseGet(Result); } while(0 != (Result[0] & (0x0F << 9)));
4) asking the eMMC's operating condition (looping till the response is valid (bit 31 in resp10)
do { // Send Operating Conditions m_pMmcd->CommandSend( MAKE_SD_COMMAND(1, MMCHS_CMD_CMD_TYPE_NORMAL, 0, MMCHS_CMD_RSP_TYPE_48BITS, 0, MMCHS_CMD_DDIR_READ), 0x40FF8000, 0, 0, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->ResponseGet(Result); } while(!(Result[0] & (1 << 31)));
5) getting the eMMC's Card Identification Data
m_bSectorMode = (Result[0] & (1 << 30)) ? true : false; // Card Identification m_pMmcd->CommandSend( MAKE_SD_COMMAND(2, MMCHS_CMD_CMD_TYPE_NORMAL, 0, MMCHS_CMD_RSP_TYPE_136BITS, 0, MMCHS_CMD_DDIR_READ), 0, 0, 0, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->GetResponse128((uint32_t*)&m_CID);
6) setting the eMMC's relative address to 0x0001
m_RCA = ++sm_NextRCA; // Set Relative Card Address m_pMmcd->CommandSend( MAKE_SD_COMMAND(3, MMCHS_CMD_CMD_TYPE_NORMAL, 0, MMCHS_CMD_RSP_TYPE_48BITS, 0, MMCHS_CMD_DDIR_READ), (m_RCA << 16), 0, 0, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->ResponseGet(Result);
7) getting the eMMC's Card Specific Data (over the CMD-line)
// get Card Specific Data over CMD line m_pMmcd->CommandSend( MAKE_SD_COMMAND(9, MMCHS_CMD_CMD_TYPE_NORMAL, 0, MMCHS_CMD_RSP_TYPE_136BITS, 0, MMCHS_CMD_DDIR_READ), (m_RCA << 16), 0, 0, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->GetResponse128((uint32_t*)&m_RawCSD);
8) setting the host's blocklength (the MMCD peripheral in the SoC) to 512
// Set BlkLen in Host m_pMmcd->BlkLenSet(512);
9) select the card
// Select Card m_pMmcd->CommandSend( MAKE_SD_COMMAND(7, MMCHS_CMD_CMD_TYPE_NORMAL, 0, MMCHS_CMD_RSP_TYPE_48BITS, 0, MMCHS_CMD_DDIR_READ), (m_RCA << 16), 0, 0, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->ResponseGet(Result);
10) get the Extended Card Specific Data (over the data lines)
// get Extended Card Specific Data m_pMmcd->CommandSend( MAKE_SD_COMMAND(8, MMCHS_CMD_CMD_TYPE_NORMAL, 1, MMCHS_CMD_RSP_TYPE_48BITS, 0, MMCHS_CMD_DDIR_READ), (m_RCA << 16), m_RawExtCSD, 1, false ); bRslt = m_pMmcd->IsCmdComplete(0xFFFF); m_pMmcd->DataGet(m_RawExtCSD, 512);
I'm stuck in step 10 : the returned data doesn't even looks like an extended CSD register....
There is activity on the DAT0 line as shown in this picture:
After the execution of CMD8 (getting the ECSD) the host controller reports that the card is READY_FOR_DATA and is in the Tran state (bits 8 and 11 are on in the controller's Resp10 register.)
Any ideas how to get the correct data from the eMMC's ECSD?
Thanks.