SD\MMC issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SD\MMC issue

1,605 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mirfan on Mon Sep 24 05:49:52 MST 2012
Hi,

I received a Hitex LPC4350 Eval board. I am currently porting SD\MMC driver using my own state machine so I am not using the driver from the LPC driver library. The issue i am having right now is that the command phase of SD\MMC card initialization completes without a hitch, but as soon as I make a data transaction over DMA, it generates a Data CRC error. Even if I do get a DMA transaction, the received data is invalid. One thing that I doubt to be the culprit is the SD clock source multiplexing. The SD clock is multiplexed with EMC controller clocks for external SDRAM. So, can SD\MMC be used along with external SDRAM? (I am currently running my image from external SDRAM)

Thanks
标签 (1)
标记 (1)
0 项奖励
回复
3 回复数

1,217 次查看
zzzmqp
Contributor III

Quote:

On that board the sdio_clk signal comes out on PC_0 which is not muxed with any of the EMC clocks so you should be fine. Of course you will need to configure the function of this pin to be the SDIO_CLK.

I have a similar setup with a LPC4337, external SDRAM (EMC) and SD card and need clarification regarding the CLK configuration:

Per UM10503:

All four EMC_CLK clock signals must be configured for all SDRAM devices

independently of their size by selecting the EMC_CLK function and enabling the input

buffer (EZI = 1) in all four SFSCLKn registers in the SCU.

Code:

Chip_SCU_PinMuxSet( 6, 11, (SCU_PINIO_FAST | SCU_MODE_FUNC3));  // CKEOUT0

Chip_SCU_ClockPinMuxSet(0, (SCU_PINIO_FAST | SCU_MODE_FUNC0));  // CLK0 connected to EMC_CLK0

Chip_SCU_ClockPinMuxSet(1, (SCU_PINIO_FAST | SCU_MODE_FUNC0));  // CLK1 connected to EMC_CLK1

Chip_SCU_ClockPinMuxSet(2, (SCU_PINIO_FAST | SCU_MODE_FUNC0));  // CLK2 connected to EMC_CLK3

Chip_SCU_ClockPinMuxSet(3, (SCU_PINIO_FAST | SCU_MODE_FUNC0));  // CLK3 connected to EMC_CLK2

My SD Card configuration based on the SDMMC example and board.c:

void board_SDMMC_init(void)

{

  Chip_SCU_PinMuxSet(0xC, 4, SDIO_DAT_PINCFG); /* PC_4 connected to SDIO_D0 */

  Chip_SCU_PinMuxSet(0xC, 5, SDIO_DAT_PINCFG); /* PC_5 connected to SDIO_D1 */

  Chip_SCU_PinMuxSet(0xC, 6, SDIO_DAT_PINCFG); /* PC_6 connected to SDIO_D2 */

  Chip_SCU_PinMuxSet(0xC, 7, SDIO_DAT_PINCFG); /* PC_7 connected to SDIO_D3 */

  Chip_SCU_PinMuxSet(0xC, 0, (SCU_PINIO_FAST_CLK | SCU_MODE_FUNC7)); // CKEOUT0

  Chip_SCU_ClockPinMuxSet(2, (SCU_PINIO_FAST | SCU_MODE_FUNC4)); // CLK2 connected to SDIO_CLK

  Chip_SCU_PinMuxSet(0xC, 10, SDIO_DAT_PINCFG); /* PC_10 connected to SDIO_CMD */

  Chip_SCU_PinMuxSet(0xC, 8, (SCU_MODE_INBUFF_EN | SCU_MODE_FUNC7)); /* PC_8 connected to SDIO_CD */

}

This doesn't work, as

Chip_SCU_ClockPinMuxSet(2, (SCU_PINIO_FAST | SCU_MODE_FUNC4));  // CLK2 connected to SDIO_CLK

takes CLK2 away from EMC.

However, this does work fine:

void board_SDMMC_init(void)

void board_SDMMC_init(void)

{

  Chip_SCU_PinMuxSet(0xC, 4, SDIO_DAT_PINCFG); /* PC_4 connected to SDIO_D0 */

  Chip_SCU_PinMuxSet(0xC, 5, SDIO_DAT_PINCFG); /* PC_5 connected to SDIO_D1 */

  Chip_SCU_PinMuxSet(0xC, 6, SDIO_DAT_PINCFG); /* PC_6 connected to SDIO_D2 */

  Chip_SCU_PinMuxSet(0xC, 7, SDIO_DAT_PINCFG); /* PC_7 connected to SDIO_D3 */

  Chip_SCU_PinMuxSet(0xC, 0, (SCU_PINIO_FAST_CLK | SCU_MODE_FUNC7)); // CKEOUT0

// Chip_SCU_ClockPinMuxSet(2, (SCU_PINIO_FAST | SCU_MODE_FUNC4)); // CLK2 connected to SDIO_CLK

  Chip_SCU_PinMuxSet(0xC, 10, SDIO_DAT_PINCFG); /* PC_10 connected to SDIO_CMD */

  Chip_SCU_PinMuxSet(0xC, 8, (SCU_MODE_INBUFF_EN | SCU_MODE_FUNC7)); /* PC_8 connected to SDIO_CD */

}

My question... is this OK? Don't I need to ClockPinMux the clock signal to SD_CLK? Is it enough to assign the SD_CLK FUNC to PC_0?

Thank you.

0 项奖励
回复

1,217 次查看
zzzmqp
Contributor III

bump

0 项奖励
回复

1,217 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by drs on Thu Sep 27 14:53:31 MST 2012
The SD\MMC can be used along with external SDRAM. The Hitex board is designed to support his.

On that board the sdio_clk signal comes out on PC_0 which is not muxed with any of the EMC clocks so you should be fine. Of course you will need to configure the function of this pin to be the SDIO_CLK.
0 项奖励
回复