LPC43S67 periph_sdmmc example error

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

LPC43S67 periph_sdmmc example error

2,925 Views
omidathari
Contributor II

Hello

I an using an lpc34S67 (OM13084) along with a OM13082 general purpose board and trying to run the periph_sdmmc example and I get the following error output.

Initializing RTC (might take few seconds)...Done
Hello NXP Semiconductors

***SDCARD demo***
Opening MESSAGE.TXT from SD Card...Card Acquire failed...
Failed.
Failed with rc=3.
Done.
Printing contents of MESSAGE.TXT...
Failed with rc=9.
Close the file.
Failed with rc=9.
Create a new file (hello.txt).
Failed with rc=13.
Write text data "Hello world!" to HELLO.TXT
Failed with rc=9.
0 bytes written.
Close the file.
Failed with rc=9.
Open root directory.
Failed with rc=13.
Directory listing...
Failed with rc=9.
Test completed.

The a fomatted card containing "message.txt" file is plugged into the sd card slot on the sheild board OM13082

Any ideas

Omid Athari

Labels (5)
0 Kudos
Reply
5 Replies

2,270 Views
Svenifax
Contributor III

On Revison B boards the documentation (UM10940) states:

3.4

Boards from revision B onward include a FET placed in-line with the VDD connection to the SD/MMC card slot (see Section 4.7). Revision B and later boards have revision printed on the silkscreen on the underside of the board near the board name; revision A boards do not have the revision shown.

4.7

On revision B and later boards there is a FET placed in-line with the VDD connection to the SD/MMC card slot. This enables the power to this peripheral to be controlled using a GPIO connection from pin 1 of CN8 LPC GP Shield.

 

signal-2020-11-30-120529.jpeg

So it's very easy to enable VDD for the SD-Card slot:

Pin1 of CN8 is connected to P2_12 (GPIO1.12). We have to set this GPIO to low to enable VDD.

In the LPCOpen 3.02 samples we have to add in file lpc_board_nxp_lpcxpresso_4337\src\board.c a few lines of code in function Board_SDMMC_Init():

 

void Board_SDMMC_Init(void)
{
	Chip_SCU_PinMuxSet(0x1, 9, SDIO_DAT_PINCFG);	/* P1.9 connected to SDIO_D0 */
	Chip_SCU_PinMuxSet(0x1, 10, SDIO_DAT_PINCFG);	/* P1.10 connected to SDIO_D1 */
	Chip_SCU_PinMuxSet(0x1, 11, SDIO_DAT_PINCFG);	/* P1.11 connected to SDIO_D2 */
	Chip_SCU_PinMuxSet(0x1, 12, SDIO_DAT_PINCFG);	/* P1.12 connected to SDIO_D3 */

	Chip_SCU_ClockPinMuxSet(2, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC4));	/* CLK2 connected to SDIO_CLK */
	Chip_SCU_PinMuxSet(0x1, 6, SDIO_DAT_PINCFG);	/* P1.6 connected to SDIO_CMD */
	Chip_SCU_PinMuxSet(0x1, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_FUNC7));	/* P1.13 connected to SDIO_CD */

	/* Enable VDD for MMMC */
	Chip_SCU_PinMuxSet(0x2, 12, (SCU_PINIO_FAST | SCU_MODE_FUNC0));
	Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 12);
	Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 12, (bool) false);
}

 

 

With this fix the sample was running without a wire between SD pin 4 and VDD.

 

0 Kudos
Reply

2,407 Views
omidathari
Contributor II

Perfect.

Thank you for all your help

0 Kudos
Reply

2,407 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Omid Athari,

   You are welcome, If your problem is solved, please mark the correct answer to close this question, thank you!

Have a great day,
Kerry

 

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

2,407 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Omid Athari,

    I found the OM13082 general purpose board didn't connect the SD card pin 4 to the VDD.

    So, please add a wire between your OM13082 general purpose board  SD card pin 4 to VDD,  you also can check the SD card pin 4, whether it has 3.3V after you connect the board to your LPCXpresso LPC43S67 board.

   Now, I modify my board,  and test the lpcopen periph_sdmmc example which download from this link:

LPCOpen Software for LPC43XX|NXP 

  After insert a SD card, I can create the hello.txt successfully.

 1. Solid a wire between SD pin 4 to 3.3V like this picture:

SD PIN4->CN7_12

pastedImage_2.png

2. Because in the lpcopen periph_sdmmc example , the code read the MESSAGE.TXT at first:

rc = f_open(&Fil, "MESSAGE.TXT", FA_READ);

you can create a MESSAGE.txt in your SD card before, the he code will read successfully.

3. These are the printf in the com from my side:

pastedImage_3.png

After running the code, you will find there has a HELLO.text file in the SD card.

pastedImage_4.png

Please follow my step, and do it again.

BTW, if in your own SD card design, for the stable working, I suggest you add the external 10K pull up in the SD card pin like the mini card circuit in the MCB4357 board:

pastedImage_6.png

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

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

2,407 Views
jmccabe
Contributor II

Thank you so much for this; absolutely perfect fix. 

0 Kudos
Reply