LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC18xx/43xx SDMMC example

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

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

Definition at line 45 of file fsmci_cfg.h.

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.