Is there any example program for interfacing sd card using SPI for LPC Xpresso 4367 board?

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

Is there any example program for interfacing sd card using SPI for LPC Xpresso 4367 board?

780 次查看
shreyas123
Contributor III

I have an SPI sd card board and want to interface it to LPC 4367.

There is an example of LPCOpen with SDIO interface but not with SPI.

Also in the SDIO in LPC Open it says that the CD and DATA3 pin needs to be connected to different pins on the board. However, the pin diagram of a sd card says that the CD and DATA3 pin are the same. So how do I connect it then?

The snippet is: 

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 */

Any help would be really appreciated.

0 项奖励
回复
1 回复

678 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Shreyas Waichal

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
The SDIO_CD is connected to pin 10 of  SD Card socket, the pin will open and close when the card is inserted and removed, in another word, the SDIO_D3 is not used to detect the SD card insertion/removal in this LPCOpen's demo.
In further, I've attached a demo which describes how to use SPI to read SD card's CID register, I think it's worth referring to even if it bases on LPC176x MCU.


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复