/**
  @page CRC_TwoBoards USART Communication Boards with CRC checksum example.
  
  @verbatim
  ******************** (C) COPYRIGHT 2015 STMicroelectronics *******************
  * @file    CRC/CRC_TwoBoards/readme.txt 
  * @author  MCD Application Team
  * @version V1.1.3
  * @date    15-December-2021
  * @brief   Description of the USART Communication Boards Interrupt Data Exchange 
  *          using Interrupt example.
  ******************************************************************************
  *
  * Copyright (c) 2015 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
   @endverbatim

@par Example Description 

This example aims to show how to verify CRC checksum while USART communication
between two STM32F30x boards.

- Hardware Description

To use this example, you need to load it on two STM32F30x boards (let's call them 
Board A and Board B) then connect these two boards through UART lines and GND.

In the firmware example uncomment the dedicated line in the main.h file to use
the USART peripheral as TRANSMITTER device or as RECIVER device.

- The connection between the pins should use a common Ground.

@verbatim
*------------------------------------------------------------------------------*
|                BOARD A                                BOARD B                |
|         ____________________                   ____________________          |
|        |                    |                 |                    |         |
|        |     TRANSMITTER    |                 |      RECIVER       |         | 
|        |     __________     |                 |     __________     |         |
|        |    |   USART  |____|TX_____________RX|____|   USART  |    |         |
|        |    |  Device1 |____|RX_____________TX|____|  Device2 |    |         |
|        |    |__________|    |                 |    |__________|    |         |
|        |                    |                 |                    |         |
|        |  O LD1             |                 |  O LD1             |         |
|        |  O LD2    Joystick |                 |  O LD2    Joystick |         |
|        |  O LD3        _    |                 |  O LD3        _    |         |
|        |              |_|   |                 |              |_|   |         |
|        |                    |                 |                    |         |
|        |             GND O--|-----------------|--O GND             |         |
|        |____________________|                 |____________________|         |
|                                                                              |
|                                                                              |
*------------------------------------------------------------------------------*
@endverbatim

- Software Description

The CRC peripheral is configured to use the 8-bit CRC polynomial x8 + x7 + x6 + x4 + x2 + 1 
with the initialization value is set to 0.

On Board A, at each joystick SEL button press:

- The USART Board A sends data already defined in TxBuffer.

- CRC value is computed during USART data transfer.  

- After computing CRC of latest transferred byte, TxBuffer is updated with final CRC value.

- The USART Board A sends latest byte which is the final computed CRC value.

On Board B,

- The USART Board B receives the data (data + CRC value) in RxBuffer.

- CRC value of received data are computed in Board B and compared with the received one.
  
  CRC checksum result is signaled by LED lightening as following:
    - CRC received and computed values are equal ==> LD2 toggles, LED3 OFF. 
    - CRC received and computed values are not equal ==> LD2 Off, LED3 ON. 

The SysTick is configured to generate interrupt each 10ms. A dedicated counter 
inside the SysTick ISR is used to toggle the LD1 each 100ms indicating that the 
firmware is running.

These operations can be repeated infinitely.

@par Directory contents 

  - CRC/CRC_TwoBoards/stm32f30x_conf.h    Library Configuration file
  - CRC/CRC_TwoBoards/stm32f30x_it.c      Interrupt handlers
  - CRC/CRC_TwoBoards/stm32f30x_it.h      Interrupt handlers header file
  - CRC/CRC_TwoBoards/main.c              Main program
  - CRC/CRC_TwoBoards/main.h              Main program header file
  - CRC/CRC_TwoBoards/system_stm32f30x.c  STM32F30x system source file
  
@note The "system_stm32f30x.c" is generated by an automatic clock configuration 
      system and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F30x_Clock_Configuration_V1.0.0.xls" 
      provided with the AN4152 package available on <a href="http://www.st.com/internet/mcu/family/141.jsp">  ST Microcontrollers </a>
  
@par Hardware and Software environment

  - This example runs on STM32F303xC and STM32F303xE Devices.
  
  - This example has been tested with STMicroelectronics STM32303C-EVAL (STM32F30x)
    evaluation board and can be easily tailored to any other supported device 
    and development board.

  - STM32303C-EVAL Set-up
    - Use The Joystick SEL button [PC.013]
    - Connect USART1 TX pin (PC.04) to USART1 RX pin (PE.01)
    - Connect USART1 RX pin (PE.01) to USART1 TX pin (PC.04)

@par How to use it ? 

In order to make the program work, you must do the following :
 - Copy all source files from this example folder to the template folder under
   Projects\STM32F30x_StdPeriph_Templates
 - Open your preferred toolchain 
 - Add the following files to the project source list
   - Utilities\STM32_EVAL\STM32303C_EVAL\stm32303c_eval.c
 - Rebuild all files and load your image into target memory
 - Run the example
    

 */
