SPI_FLASH
[STM32F10x_StdPeriph_Examples]

Defines

#define BufferSize   (countof(Tx_Buffer)-1)
#define countof(a)   (sizeof(a) / sizeof(*(a)))
#define FLASH_ReadAddress   FLASH_WriteAddress
#define FLASH_SectorToErase   FLASH_WriteAddress
#define FLASH_WriteAddress   0x700000
#define sFLASH_ID   sFLASH_M25P64_ID

Enumerations

enum  TestStatus {
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED
}

Functions

TestStatus Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength)
 Compares two buffers.
void BusFault_Handler (void)
 This function handles Bus Fault exception.
void DebugMon_Handler (void)
 This function handles Debug Monitor exception.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void MemManage_Handler (void)
 This function handles Memory Manage exception.
void NMI_Handler (void)
 This function handles NMI exception.
void PendSV_Handler (void)
 This function handles PendSV_Handler exception.
void SVC_Handler (void)
 This function handles SVCall exception.
void SysTick_Handler (void)
 This function handles SysTick Handler.
void UsageFault_Handler (void)
 This function handles Usage Fault exception.

Variables

__IO uint32_t FlashID = 0
__IO uint8_t Index = 0x0
uint8_t Rx_Buffer [BufferSize]
volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = PASSED
uint8_t Tx_Buffer [] = "STM32F10x SPI Firmware Library Example: communication with an M25P SPI FLASH"

Define Documentation

#define BufferSize   (countof(Tx_Buffer)-1)
#define countof (  )     (sizeof(a) / sizeof(*(a)))
#define FLASH_ReadAddress   FLASH_WriteAddress

Definition at line 38 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

#define FLASH_SectorToErase   FLASH_WriteAddress

Definition at line 39 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

#define FLASH_WriteAddress   0x700000

Definition at line 37 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

#define sFLASH_ID   sFLASH_M25P64_ID

Definition at line 44 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().


Enumeration Type Documentation

enum TestStatus
Enumerator:
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 

Definition at line 34 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.


Function Documentation

TestStatus Buffercmp ( uint8_t *  pBuffer1,
uint8_t *  pBuffer2,
uint16_t  BufferLength 
)

Compares two buffers.

Parameters:
pBuffer1,pBuffer2,: buffers to be compared.
BufferLength,: buffer's length
Return values:
PASSED,: pBuffer1 identical to pBuffer2 FAILED: pBuffer1 differs from pBuffer2

Definition at line 144 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

References FAILED, and PASSED.

void BusFault_Handler ( void   ) 

This function handles Bus Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 83 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void DebugMon_Handler ( void   ) 

This function handles Debug Monitor exception.

Parameters:
None 
Return values:
None 

Definition at line 107 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void HardFault_Handler ( void   ) 

This function handles Hard Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 59 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

int main ( void   ) 

Main program.

Parameters:
None 
Return values:
None 

< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file

Definition at line 67 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

References Buffercmp(), BufferSize, FAILED, FLASH_ReadAddress, FLASH_SectorToErase, FLASH_WriteAddress, FlashID, Index, LED1, LED2, Rx_Buffer, sFLASH_EraseSector(), sFLASH_ID, sFLASH_Init(), sFLASH_ReadBuffer(), sFLASH_ReadID(), sFLASH_WriteBuffer(), STM_EVAL_LEDInit(), STM_EVAL_LEDOn(), TransferStatus1, TransferStatus2, and Tx_Buffer.

void MemManage_Handler ( void   ) 

This function handles Memory Manage exception.

Parameters:
None 
Return values:
None 

Definition at line 71 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void NMI_Handler ( void   ) 

This function handles NMI exception.

Parameters:
None 
Return values:
None 

Definition at line 50 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void PendSV_Handler ( void   ) 

This function handles PendSV_Handler exception.

Parameters:
None 
Return values:
None 

Definition at line 123 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void SVC_Handler ( void   ) 

This function handles SVCall exception.

Parameters:
None 
Return values:
None 

Definition at line 115 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void SysTick_Handler ( void   ) 

This function handles SysTick Handler.

Parameters:
None 
Return values:
None 

Definition at line 131 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.

void UsageFault_Handler ( void   ) 

This function handles Usage Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 95 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/stm32f10x_it.c.


Variable Documentation

__IO uint32_t FlashID = 0

Definition at line 57 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

__IO uint8_t Index = 0x0
uint8_t Rx_Buffer[BufferSize]

Definition at line 54 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = PASSED
uint8_t Tx_Buffer[] = "STM32F10x SPI Firmware Library Example: communication with an M25P SPI FLASH"

Definition at line 53 of file STM32F10x_StdPeriph_Examples/SPI/SPI_FLASH/main.c.

Referenced by main().

STM32F10x Standard Peripherals Library: Footer

 

 

 

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