Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32_adafruit_sd.c File Reference
This file provides a set of functions needed to manage the SD card mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802), that is used with the STM32 Nucleo board through SPI interface. It implements a high level communication layer for read and write from/to this memory. The needed STM32XXxx hardware resources (SPI and GPIO) are defined in stm32XXxx_nucleo.h file, and the initialization is performed in SD_IO_Init() function declared in stm32XXxx_nucleo.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and SD_IO_Init() function. More...
Go to the source code of this file.
Functions | |
static uint8_t | SD_GetCIDRegister (SD_CID *Cid) |
Reads the SD card CID register. | |
static uint8_t | SD_GetCSDRegister (SD_CSD *Csd) |
Reads the SD card SCD register. | |
static uint8_t | SD_GetDataResponse (void) |
Gets the SD card data response. | |
static uint8_t | SD_GoIdleState (void) |
Put the SD in Idle state. | |
static uint8_t | SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response) |
Sends 5 bytes command to the SD card and get response. | |
uint8_t | BSP_SD_Init (void) |
Initializes the SD/SD communication. | |
uint8_t | BSP_SD_GetCardInfo (SD_CardInfo *pCardInfo) |
Returns information about specific card. | |
uint8_t | BSP_SD_ReadBlocks (uint32_t *pData, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks) |
Reads block(s) from a specified address in the SD card, in polling mode. | |
uint8_t | BSP_SD_WriteBlocks (uint32_t *pData, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks) |
Writes block(s) to a specified address in the SD card, in polling mode. | |
uint8_t | BSP_SD_GetStatus (void) |
Returns the SD status. | |
uint8_t | BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr) |
Erases the specified memory area of the given SD card. |
Detailed Description
This file provides a set of functions needed to manage the SD card mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802), that is used with the STM32 Nucleo board through SPI interface. It implements a high level communication layer for read and write from/to this memory. The needed STM32XXxx hardware resources (SPI and GPIO) are defined in stm32XXxx_nucleo.h file, and the initialization is performed in SD_IO_Init() function declared in stm32XXxx_nucleo.c file. You can easily tailor this driver to any other development board, by just adapting the defines for hardware resources and SD_IO_Init() function.
- Version:
- V1.0.0
- Date:
- 22-April-2014 +-------------------------------------------------------+ | Pin assignment | +-------------------------+---------------+-------------+ | STM32XXxx 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 | +-------------------------+---------------+-------------+
- Attention:
© COPYRIGHT(c) 2014 STMicroelectronics
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file stm32_adafruit_sd.c.
Generated on Tue Jul 12 2022 20:10:41 by
