| 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
LPC18xx/43xx 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 (Hitex A4 board) or microSD card (NGX or Keil boards) and connect a serial cable to the board's RS232/UART port start a terminal program to monitor the port. The terminal program on the host PC should be setup for 115K8N1.

Special connection requirements

- Hitex LPC1850EVA-A4-2 and LPC4350EVA-A4-2 boards
  - Close pin 1-2 of JP9
  - Open all SV3, SV6
  - Close all SV12
  - Uart1 terminal port: SV11-p2(U1_RXD) connect to SV1-p7, SV11-p4 (U1_TXD) connect to SV1-p5
- Keil MCB1857 and MCB4357 boards (debug output terminal on Uart3)
- NGX LPC1830 LPC4330 (no debug output terminal)

Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4
LPC18xx/43xx example quickstart for IAR EWARM
LPC18xx/43xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Hitex 1850 evaluation boards
Hitex 4350 evaluation boards
Keil 1857 evaluation boards
Keil 4357 evaluation boards
NGX 1830 Xplorer boards
NGX 4330 Xplorer boards

Submitting LPCOpen issues:
Community support for LPCOpen

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

## Functions
static void | sdmmc_waitms (uint32_t time)
static void | sdmmc_setup_wakeup (void *bits)
| Sets up the SD event driven wakeup.
static uint32_t | sdmmc_irq_driven_wait (void)
| A better wait callback for SDMMC driven by the IRQ flag.
static void | App_SDMMC_Init ()
void | die (FRESULT rc)
| Error processing function: stop with dying message.
void | SDIO_IRQHandler (void)
| SDIO controller interrupt handler.
int | main (void)
| Main routine for SDMMC example.

## Variables
static FATFS | Fatfs
static FIL | Fil
static uint32_t | Buff [BUFFER_SIZE/sizeof(uint32_t)]
static volatile UINT | Timer = 0
static volatile int32_t | sdio_wait_exit = 0
mci_card_struct | sdcardinfo

## Macro Definition Documentation

#define BUFFER_SIZE 4096

Definition at line 86 of file sdmmc.c.

#define debugstr | ( |  | str | ) | DEBUGSTR(str)

Definition at line 82 of file sdmmc.c.

## Typedef Documentation

typedef mci_card_struct CARD_HANDLE_T

Definition at line 45 of file fsmci_cfg.h.

typedef mci_card_struct CARD_HANDLE_T

Definition at line 45 of file fsmci_cfg.h.

## Function Documentation

static void App_SDMMC_Init | ( |  | ) |
| static

Definition at line 159 of file sdmmc.c.

void die | ( | FRESULT | rc | ) |

Error processing function: stop with dying message.

Parameters

  rc | : FatFs return value

Returns
  Nothing

Definition at line 210 of file sdmmc.c.

int main | ( | void |  | ) |

Main routine for SDMMC example.

Main program body.

Returns
  Nothing

Definition at line 237 of file sdmmc.c.

void SDIO_IRQHandler | ( | void |  | ) |

SDIO controller interrupt handler.

Returns
  Nothing

Definition at line 220 of file sdmmc.c.

static uint32_t sdmmc_irq_driven_wait | ( | void |  | ) |
| static

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

Returns
  0 on success, or failure condition (-1)

Definition at line 145 of file sdmmc.c.

static void sdmmc_setup_wakeup | ( | void * | bits | ) |
| static

Sets up the SD event driven wakeup.

Parameters

  bits | : Status bits to poll for command completion

Returns
  Nothing

Definition at line 131 of file sdmmc.c.

static void sdmmc_waitms | ( | uint32_t | time | ) |
| static

Definition at line 107 of file sdmmc.c.

## Variable Documentation

uint32_t Buff[BUFFER_SIZE/sizeof(uint32_t)]
| static

Definition at line 90 of file sdmmc.c.

FATFS Fatfs
| static

Definition at line 88 of file sdmmc.c.

FIL Fil
| static

Definition at line 89 of file sdmmc.c.

mci_card_struct sdcardinfo

Type used for SD Card handle

Definition at line 100 of file sdmmc.c.

volatile int32_t sdio_wait_exit = 0
| static

Definition at line 93 of file sdmmc.c.

volatile UINT Timer = 0
| static

Definition at line 92 of file sdmmc.c.