stm32_eval_spi_flash.c File Reference

This file provides a set of functions needed to manage the SPI M25Pxxx FLASH 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 sFLASH_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 sFLASH_LowLevel_Init() function. More...

#include "stm32_eval_spi_flash.h"
#include "stm32_eval.h"

Go to the source code of this file.

Functions

void sFLASH_DeInit (void)
 DeInitializes the peripherals used by the SPI FLASH driver.
void sFLASH_EraseBulk (void)
 Erases the entire FLASH.
void sFLASH_EraseSector (uint32_t SectorAddr)
 Erases the specified FLASH sector.
void sFLASH_Init (void)
 Initializes the peripherals used by the SPI FLASH driver.
void sFLASH_ReadBuffer (uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead)
 Reads a block of data from the FLASH.
uint8_t sFLASH_ReadByte (void)
 Reads a byte from the SPI Flash.
uint32_t sFLASH_ReadID (void)
 Reads FLASH identification.
uint8_t sFLASH_SendByte (uint8_t byte)
 Sends a byte through the SPI interface and return the byte received from the SPI bus.
uint16_t sFLASH_SendHalfWord (uint16_t HalfWord)
 Sends a Half Word through the SPI interface and return the Half Word received from the SPI bus.
void sFLASH_StartReadSequence (uint32_t ReadAddr)
 Initiates a read data byte (READ) sequence from the Flash.
void sFLASH_WaitForWriteEnd (void)
 Polls the status of the Write In Progress (WIP) flag in the FLASH's status register and loop until write opertaion has completed.
void sFLASH_WriteBuffer (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite)
 Writes block of data to the FLASH.
void sFLASH_WriteEnable (void)
 Enables the write access to the FLASH.
void sFLASH_WritePage (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite)
 Writes more than one byte to the FLASH with a single WRITE cycle (Page WRITE sequence).

Detailed Description

This file provides a set of functions needed to manage the SPI M25Pxxx FLASH 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 sFLASH_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 sFLASH_LowLevel_Init() function.

Author:
MCD Application Team
Version:
V4.3.0
Date:
10/15/2010 +-----------------------------------------------------------+ | Pin assignment | +-----------------------------+---------------+-------------+ | STM32 SPI Pins | sFLASH | Pin | +-----------------------------+---------------+-------------+ | sFLASH_CS_PIN | ChipSelect(/S)| 1 | | sFLASH_SPI_MISO_PIN / MISO | DataOut(Q) | 2 | | | VCC | 3 (3.3 V)| | | GND | 4 (0 V) | | sFLASH_SPI_MOSI_PIN / MOSI | DataIn(D) | 5 | | sFLASH_SPI_SCK_PIN / SCLK | Clock(C) | 6 | | | VCC | 7 (3.3 V)| | | VCC | 8 (3.3 V)| +-----------------------------+---------------+-------------+

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_flash.c.

STM32F10x Standard Peripherals Library: Footer

 

 

 

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