USART_Synchronous
[STM32F10x_StdPeriph_Examples]

Defines

#define countof(a)   (sizeof(a) / sizeof(*(a)))
#define DYMMY_BYTE   0x00
#define TxBufferSize1   (countof(TxBuffer1) - 1)
#define TxBufferSize2   (countof(TxBuffer2) - 1)

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 GPIO_Configuration (void)
 Configures the different GPIO ports.
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 RCC_Configuration (void)
 Configures the different system clocks.
void SPI_Configuration (void)
 Configures the SPI.
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 uint8_t NbrOfDataToRead1 = TxBufferSize2
__IO uint8_t NbrOfDataToRead2 = TxBufferSize1
uint8_t RxBuffer1 [TxBufferSize2]
uint8_t RxBuffer2 [TxBufferSize1]
__IO uint8_t RxCounter1 = 0
__IO uint8_t RxCounter2 = 0
volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = FAILED
uint8_t TxBuffer1 [] = "USART Synchronous Example: USARTy -> SPIy using TXE and RXNE Flags"
uint8_t TxBuffer2 [] = "USART Synchronous Example: SPIy -> USARTy using TXE and RXNE Flags"
__IO uint8_t TxCounter1 = 0
__IO uint8_t TxCounter2 = 0
USART_ClockInitTypeDef USART_ClockInitStructure
USART_InitTypeDef USART_InitStructure

Define Documentation

#define countof (  )     (sizeof(a) / sizeof(*(a)))
#define DYMMY_BYTE   0x00

Definition at line 39 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/main.c.

Referenced by main().

#define TxBufferSize1   (countof(TxBuffer1) - 1)
#define TxBufferSize2   (countof(TxBuffer2) - 1)

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/USART/Synchronous/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 259 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/main.c.

References FAILED, and PASSED.

void BusFault_Handler ( void   ) 

This function handles Bus Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 85 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.

void DebugMon_Handler ( void   ) 

This function handles Debug Monitor exception.

Parameters:
None 
Return values:
None 

Definition at line 120 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.

void GPIO_Configuration ( void   ) 
void HardFault_Handler ( void   ) 

This function handles Hard Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 59 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/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 71 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/main.c.

References Buffercmp(), DYMMY_BYTE, ENABLE, GPIO_Configuration(), NbrOfDataToRead1, NbrOfDataToRead2, RCC_Configuration(), RESET, RxBuffer1, RxBuffer2, RxCounter1, RxCounter2, SPI_Configuration(), SPI_I2S_FLAG_RXNE, SPI_I2S_FLAG_TXE, SPI_I2S_GetFlagStatus(), SPI_I2S_ReceiveData(), SPI_I2S_SendData(), TransferStatus1, TransferStatus2, TxBuffer1, TxBuffer2, TxBufferSize1, TxBufferSize2, TxCounter1, TxCounter2, USART_InitTypeDef::USART_BaudRate, USART_ClockInitTypeDef::USART_Clock, USART_Clock_Enable, USART_ClockInit(), USART_Cmd(), USART_ClockInitTypeDef::USART_CPHA, USART_CPHA_2Edge, USART_ClockInitTypeDef::USART_CPOL, USART_CPOL_High, USART_FLAG_RXNE, USART_FLAG_TC, USART_GetFlagStatus(), USART_InitTypeDef::USART_HardwareFlowControl, USART_HardwareFlowControl_None, USART_Init(), USART_ClockInitTypeDef::USART_LastBit, USART_LastBit_Enable, USART_InitTypeDef::USART_Mode, USART_Mode_Rx, USART_Mode_Tx, USART_InitTypeDef::USART_Parity, USART_Parity_No, USART_ReceiveData(), USART_SendData(), USART_InitTypeDef::USART_StopBits, USART_StopBits_1, USART_InitTypeDef::USART_WordLength, and USART_WordLength_8b.

void MemManage_Handler ( void   ) 

This function handles Memory Manage exception.

Parameters:
None 
Return values:
None 

Definition at line 72 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/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/USART/Synchronous/stm32f10x_it.c.

void PendSV_Handler ( void   ) 

This function handles PendSV_Handler exception.

Parameters:
None 
Return values:
None 

Definition at line 129 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.

void RCC_Configuration ( void   ) 
void SPI_Configuration ( void   ) 
void SVC_Handler ( void   ) 

This function handles SVCall exception.

Parameters:
None 
Return values:
None 

Definition at line 111 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.

void SysTick_Handler ( void   ) 

This function handles SysTick Handler.

Parameters:
None 
Return values:
None 

Definition at line 138 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.

void UsageFault_Handler ( void   ) 

This function handles Usage Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 98 of file STM32F10x_StdPeriph_Examples/USART/Synchronous/stm32f10x_it.c.


Variable Documentation

__IO uint8_t NbrOfDataToRead1 = TxBufferSize2
__IO uint8_t NbrOfDataToRead2 = TxBufferSize1
uint8_t RxBuffer1[TxBufferSize2]
uint8_t RxBuffer2[TxBufferSize1]
__IO uint8_t RxCounter1 = 0
__IO uint8_t RxCounter2 = 0
volatile TestStatus TransferStatus1 = FAILED
volatile TestStatus TransferStatus2 = FAILED
uint8_t TxBuffer1[] = "USART Synchronous Example: USARTy -> SPIy using TXE and RXNE Flags"
uint8_t TxBuffer2[] = "USART Synchronous Example: SPIy -> USARTy using TXE and RXNE Flags"
__IO uint8_t TxCounter1 = 0
__IO uint8_t TxCounter2 = 0
STM32F10x Standard Peripherals Library: Footer

 

 

 

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