| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
LPC17xx/40xx SDMMC example
Peripheral examples

## Detailed Description

Example description
This example describes how to use the SD/MMC interface with a SD card and a FATFS filesystem.

To use the example, plug a SD card, connect a serial cable to the board's RS232/UART port and start a terminal program to monitor the port. The terminal program on the host PC should be setup for 115K8N1.

Special connection requirements
There are no special connection requirements for this example.

Build procedures:
LPC17xx/40xx example quickstart for Keil uVision4
LPC17xx/40xx example quickstart for IAR EWARM
LPC17xx/40xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Embedded Artists' LPC1788 Developer's Kit
Embedded Artists' LPC4088 Developer's Kit

Submitting LPCOpen issues:
Community support for LPCOpen

## Macros
#define | debugstr(str) DEBUGOUT(str)
#define | BUFFER_SIZE 4096

## Functions
STATIC void | waitMs (uint32_t time)
STATIC void | setupEvWakeup (void *pEvent)
| Sets up the event driven wakeup.
STATIC uint32_t | waitEvIRQDriven (void)
| A better wait callback for SDMMC driven by the IRQ flag.
STATIC void | initAppTimer (void)
STATIC void | initAppSDMMC ()
void | die (FRESULT rc)
| Error processing function: stop with dying message.
void | SysTick_Handler (void)
| System tick interrupt handler.
void | SDIO_IRQHandler (void)
| SDC interrupt handler sub-routine.
int | main (void)
| Main routine for SDMMC example.

## Variables
STATIC FATFS | fatFS
STATIC FIL | fileObj
STATIC INT | buffer [BUFFER_SIZE/4]
STATIC volatile int32_t | sdcWaitExit = 0
STATIC SDMMC_EVENT_T * | event
STATIC volatile Status | eventResult = ERROR
SDMMC_CARD_T | sdCardInfo
volatile uint32_t | timerCntms = 0

## Macro Definition Documentation

#define BUFFER_SIZE 4096

Definition at line 71 of file sdmmc.c.

#define debugstr | ( |  | str | ) | DEBUGOUT(str)

Definition at line 68 of file sdmmc.c.

## Typedef Documentation

typedef SDMMC_CARD_T CARD_HANDLE_T

Definition at line 45 of file fsmci_cfg.h.

## Function Documentation

void die | ( | FRESULT | rc | ) |

Error processing function: stop with dying message.

Parameters

  rc | : FatFs return value

Returns
  Nothing

Definition at line 164 of file sdmmc.c.

STATIC void initAppSDMMC | ( |  | ) |

Definition at line 143 of file sdmmc.c.

STATIC void initAppTimer | ( | void |  | ) |

Definition at line 136 of file sdmmc.c.

int main | ( | void |  | ) |

Main routine for SDMMC example.

Main program body.

Returns
  Nothing

Definition at line 230 of file sdmmc.c.

void SDIO_IRQHandler | ( | void |  | ) |

SDC interrupt handler sub-routine.

Returns
  Nothing

Definition at line 196 of file sdmmc.c.

STATIC void setupEvWakeup | ( | void * | pEvent | ) |

Sets up the event driven wakeup.

Parameters

  pEvent | : Event information

Returns
  Nothing

Definition at line 106 of file sdmmc.c.

void SysTick_Handler | ( | void |  | ) |

System tick interrupt handler.

SysTick 1mS tick handler.

Returns
  Nothing

Definition at line 174 of file sdmmc.c.

STATIC uint32_t waitEvIRQDriven | ( | void |  | ) |

A better wait callback for SDMMC driven by the IRQ flag.

Returns
  0 on success, or failure condition (Nonzero)

Definition at line 124 of file sdmmc.c.

STATIC void waitMs | ( | uint32_t | time | ) |

Definition at line 92 of file sdmmc.c.

## Variable Documentation

STATIC INT buffer[BUFFER_SIZE/4]

Definition at line 75 of file sdmmc.c.

STATIC SDMMC_EVENT_T* event

Definition at line 77 of file sdmmc.c.

STATIC volatile Status eventResult = ERROR

Definition at line 78 of file sdmmc.c.

STATIC FATFS fatFS

Definition at line 73 of file sdmmc.c.

STATIC FIL fileObj

Definition at line 74 of file sdmmc.c.

SDMMC_CARD_T sdCardInfo

Type used for SD Card handle

Definition at line 85 of file sdmmc.c.

STATIC volatile int32_t sdcWaitExit = 0

Definition at line 76 of file sdmmc.c.

volatile uint32_t timerCntms = 0

Definition at line 86 of file sdmmc.c.