LPC1788 SDIO driver emmc 4bit mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1788 SDIO driver emmc 4bit mode

2,650 Views
mini92
Contributor I

I use LPC1788 SDIO connected emmc?

 emmc use 4bit mode

use drive:

* $Id$ lpc177x_8x_mci.c 2011-06-02
*//**
* @file lpc177x_8x_mci.c
* @brief Contains all functions support for MCI firmware library
* on LPC177x_8x

but  In initialization  send CMD1 return value err.

if (MCI_Cmd_SendOpCond() == MCI_FUNC_OK)  

in this function return value err,

Who can help me ?????

Labels (1)
0 Kudos
12 Replies

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li 

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.
I was wondering if you can share the demo and tell me board which you run with.

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,617 Views
mini92
Contributor I

Thank you ask me 

I use board sch is:

pastedImage_1.png

Remove CN2  

D0 D1 D2 D3 CMD  CLK VDD  VSS connection eMMC  

pastedImage_2.png

V+ connect VDD         Gnd  connect Vss

0 Kudos

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li,

The demo works well on my site.

So I've attached the sch of the LPC1788 develop kit and the responding code, please refer to them for details.

2017-07-21_15-39-13.jpg

Demo:

lpc407x_8x_177x_8x.zip - Google Drive
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,617 Views
mini92
Contributor I

hi jeremyzhou 

 thank ask me 

  

  I use samsung emmc chip is KLM4G1FE3B  I change I change the circuit as well as you

D0 D1 D2 D3 CMD  CLK VDD  VSS connection eMMC    V+ connect VDD         Gnd  connect Vss

use soft same  

But in the initialization time or stopped CMD 1 read ocr register

KLM4G1FE3B  is emmc 4.41 chip

  

can you help me thank you,

0 Kudos

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li,

Thanks for your reply, I am working on it, and I will share some the updates later.

Thanks for your understanding.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,617 Views
mini92
Contributor I

hi jeremyzhou ,

   I read ohter  MCU SDIO emmc driver

 

Found that there are many bugs

 such as:

file: fs_mci.c

function :

/**
* @brief Read card configuration and fill structure CardConfig.
*
* @param None
* @retval TRUE or FALSE.
*/
Bool mci_read_configuration (void)

 

line 276 :

Select Card after  if card is eMMC need read  Extended CSD Register 

file: lpc_mci.c

function: int32_t MCI_Cmd_SendOpCond( void )

line 1229      cmdIf.Argument = OCR_INDEX;

 

OCR_INDEX value is err in eMMC chip KLM4G1FE3B

 

can you help me thank you,

0 Kudos

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li,

I have gone over the datasheet of the KLM4G1FE3B and LPC1788.

I find that the MCI Module conforms to the Multimedia Card Specification v2.11, and the KLM4G1FE3B should work in 1 bit data bus to full backward compatibility with the previous MultiMediaCard system which includes the Multimedia Card Specification v2.11.

2017-07-25_15-50-52.jpg

So I think you need to adapt the demo code to this feature.

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,617 Views
mini92
Contributor I

hi jeremyzhou ,

Thanks for your reply

I change  fs_mci.c test   

 

use 1 bit mode OCR register read ok but

Still can not read the sector correctly

This KLM4G1FE3B emmc I use USB  card reader format  and write data

debug in LPC1788 read select data not my write data  

can you help me thank you,

0 Kudos

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li,

Thanks for your reply.

I was wondering if you can describe the testing process in details, as I'm not very clear with  the issue you encountered.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,616 Views
mini92
Contributor I

hi jeremyzhou ,

 

 

Thanks for your reply

I change drive:

/************************************************************************//**
* @brief Send CMD1 (SEND_OP_COND) to card.
*
* @param None
*
* @return MCI_FUNC_OK if all success
****************************************************************************/
int32_t MCI_Cmd_SendOpCond( void )
{
volatile uint32_t i;
uint32_t retryCount;
uint32_t respStatus;
uint32_t respValue[4];
st_Mci_CmdInfo cmdIf;
int32_t retval = MCI_FUNC_FAILED;

retryCount = 0x200; /* reset retry counter */

cmdIf.CmdIndex = CMD1_SEND_OP_COND; /*CMD 1*/
//cmdIf.Argument = OCR_INDEX; /*¶ÁÈ¡ocr¼Ä´æÆ÷*/
cmdIf.Argument = 0x40FC0000; /*µ÷Õû´Ë´¦³õʼ»¯ÎÊÌâok*/

cmdIf.ExpectResp = EXPECT_SHORT_RESP; /*¶Ì¸ñʽָÁî*/
cmdIf.AllowTimeout = ALLOW_CMD_TIMER; /*µÈ´ýÃüÁî½áÊø*/
cmdIf.CmdResp = (uint32_t *)&respValue[0];
/* continuously sends until the busy bit is cleared */
while ( retryCount > 0 )

//////////////and set 1bit  mode

if ((CardConfig.CardType== MCI_SDSC_V1_CARD) ||
(CardConfig.CardType== MCI_SDSC_V2_CARD) ||
(CardConfig.CardType== MCI_SDHC_SDXC_CARD))
{
if (MCI_SetBusWidth( SD_4_BIT ) != MCI_FUNC_OK ) /* ÉèÖÃ×ÜÏßλ¿í 1788Ö»ÓÐ 4bitģʽ */
{
break;
}
}
else
{
if (MCI_SetBusWidth( SD_1_BIT ) != MCI_FUNC_OK )
{
break;
}
}

hardware change is mmc card read connection

I usb card read AU6438 USB SDcard reader format emmc chip and write select data

0 Kudos

1,617 Views
jeremyzhou
NXP Employee
NXP Employee

Hi chao li,

To figure out the root cause of the issue, you need to check the sequence of reading data by referring to the attached document: Embedded MultiMediaCard (eMMC) eMMC/Card Product Standard, High Capacity, including Reliable Write, Boot, and Sleep Modes, and you'd better to capture the wave of DATA0 pin via the oscilloscope or logical analyzer, the wave absolutely will give some inspiration.

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,617 Views
mini92
Contributor I

hi jeremyzhou ,

Thanks for your reply

I found that the error was seen by using a logic analyzer

pastedImage_1.png

pastedImage_1.png

But for the 1788 SDIO peripherals to use, in accordance with the bottom of the waveform drive is too inconvenient

According to the existing SD drive speculation

and I do not know 1788 sdio peripherals register details of the operation, the bottom of the 1788 drive up too painful

0 Kudos