Professional Documents
Culture Documents
This application note describes an implementation of the multi media card (MMC) interface to the eCOG1k microcontroller, using the SPI bus protocol.
28 January 2008
AN037
Version 1.0
28 January 2008
Page 2 of 10
AN037
Version 1.0
Revision History
Version V1.0 Date 22/03/2006 Notes Initial Version
28 January 2008
Page 3 of 10
AN037
Version 1.0
Contents
1 2 3 4 5 6 Introduction.......................................................................................... 5 Glossary .............................................................................................. 5 MMC and SD Card overview ............................................................... 5 eCOG1k Hardware .............................................................................. 6 The MMC/SD Card Library on the eCOG1k ........................................ 7 Example Software ............................................................................... 7
6.1 6.2 Configuration ............................................................................................. 7 Example Software Operation..................................................................... 7
Appendix A
28 January 2008
Page 4 of 10
AN037
Version 1.0
1 Introduction
This application note describes an implementation of the multi media card (MMC) interface to the eCOG1k microcontroller using the SPI bus protocol. The application software is based on public ccar6.641 c1l Td(atiodButd-<NU 5(scar6c 6e-2( .0002 agretrolmnt >BDC /TTSp)5(1 Tf-0.3002 Tc -098 90 7386
AN037
Version 1.0
4 eCOG1k Hardware
This application note is based on the use of an MMC/SD card interface daughter board, connected to the eCOG1k evaluation board. The daughter board contains a card socket, as well as the necessary connections for monitorinf(s 960.7gol.1.0 )]TJEM/Sp[( /P </MC3D 2 >BDTJ0.2003 Tc -0.6024 T7
R3 Table 1 and
AN037
Version 1.0
Port A0 A1 A2
Pin 40 41 42
Function LED0, active low, indicates card in LED1, active low, indicates card locked
AN037
Version 1.0
Command i r w
Function Reset and initialise MMC/SD card for operation Read the current sector to the buffer, and display the results
AN037
Version 1.0
nsigned int mmcReset(void); u Resets the MMC/SD card interface, and configures the device fr efB 17.0sd via SPI
AN037
Version 1.0
nsigned int mmcRead(unsigned long sector, nsigned char *buffer); u u Read a block of data from the MMC/SD card into a buffer. Parameters sector *buffer Returns 0 if the read was successful, otherwise returns the response from the MMC/SD card. Example
mmcRead(sector, buffer); // Read the sector to the buffer
The MMC/SD block to read Character pointer to the buffer used to store the read data
nsigned int mmcWrite(unsigned long sector, nsigned char *buffer); u u Write the buffer data to the MMC/SD card block. Parameters sector *buffer Returns 0 if the write was successful, otherwise returns the response from the MMC/SD card. Example
mmcWrite(sector, buffer); // Write the buffer to the specified sector
The MMC/SD block to read Character pointer to the buffer used to store the data to write
28 January 2008
Page 10 of 10