stm32_eval_spi_sd.c File Reference

This file provides a set of functions needed to manage the SPI SD Card memory mounted on STM32xx-EVAL board (refer to stm32_eval.h to know about the boards supporting this memory). It implements a high level communication layer for read and write from/to this memory. The needed STM32 hardware resources (SPI and GPIO) are defined in stm32xx_eval.h file, and the initialization is performed in SD_LowLevel_Init() function declared in stm32xx_eval.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and SD_LowLevel_Init() function. More...

#include "stm32_eval_spi_sd.h"
#include "stm32_eval.h"

Go to the source code of this file.

Functions

void SD_DeInit (void)
 DeInitializes the SD/SD communication.
uint8_t SD_Detect (void)
 Detect if SD card is correctly plugged in the memory slot.
SD_Error SD_GetCardInfo (SD_CardInfo *cardinfo)
 Returns information about specific card.
SD_Error SD_GetCIDRegister (SD_CID *SD_cid)
 Read the CID card register.
SD_Error SD_GetCSDRegister (SD_CSD *SD_csd)
 Read the CSD card register.
uint8_t SD_GetDataResponse (void)
 Get SD card data response.
SD_Error SD_GetResponse (uint8_t Response)
 Returns the SD response.
uint16_t SD_GetStatus (void)
 Returns the SD status.
SD_Error SD_GoIdleState (void)
 Put SD in Idle state.
SD_Error SD_Init (void)
 Initializes the SD/SD communication.
SD_Error SD_ReadBlock (uint8_t *pBuffer, uint32_t ReadAddr, uint16_t BlockSize)
 Reads a block of data from the SD.
uint8_t SD_ReadByte (void)
 Read a byte from the SD.
SD_Error SD_ReadMultiBlocks (uint8_t *pBuffer, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Reads multiple block of data from the SD.
void SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc)
 Send 5 bytes command to the SD card.
SD_Error SD_WriteBlock (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t BlockSize)
 Writes a block on the SD.
uint8_t SD_WriteByte (uint8_t Data)
 Write a byte on the SD.
SD_Error SD_WriteMultiBlocks (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Writes many blocks on the SD.

Detailed Description

This file provides a set of functions needed to manage the SPI SD Card memory mounted on STM32xx-EVAL board (refer to stm32_eval.h to know about the boards supporting this memory). It implements a high level communication layer for read and write from/to this memory. The needed STM32 hardware resources (SPI and GPIO) are defined in stm32xx_eval.h file, and the initialization is performed in SD_LowLevel_Init() function declared in stm32xx_eval.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and SD_LowLevel_Init() function.

Author:
MCD Application Team
Version:
V4.3.0
Date:
10/15/2010 +-------------------------------------------------------+ | Pin assignment | +-------------------------+---------------+-------------+ | STM32 SPI Pins | SD | Pin | +-------------------------+---------------+-------------+ | SD_SPI_CS_PIN | ChipSelect | 1 | | SD_SPI_MOSI_PIN / MOSI | DataIn | 2 | | | GND | 3 (0 V) | | | VDD | 4 (3.3 V)| | SD_SPI_SCK_PIN / SCLK | Clock | 5 | | | GND | 6 (0 V) | | SD_SPI_MISO_PIN / MISO | DataOut | 7 | +-------------------------+---------------+-------------+

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics

Definition in file stm32_eval_spi_sd.c.

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32