/*!
 * @file        readme.txt
 *
 * @brief       This file is routine instruction
 *
 * @version     V1.0.0
 *
 * @date        2026-11-09
 *
 * @attention
 *
 *  Copyright (C) 2020-2026 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */


&par Example Description

This example exchanges 56 bytes between two APM32F107 MINI boards over SPI1
full duplex. The CPU polls TXE, RXNE and BSY for every byte.

SPI1 is configured as 8-bit, MSB first, clock polarity high, first clock edge,
baud rate PCLK2/256. PA4 is hardware NSS. The master keeps NSS high until the
transfer starts, then pulls it low by enabling SPI1.

The same project is used on both boards. In Include/main.h:
 - uncomment SPI_MASTER on the master board
 - leave SPI_MASTER commented on the slave board

Reset the slave board first, then the master board. The master waits 500 ms
so the slave can preload its first byte. Both boards print the received
buffer on USART1. LED2 turns on when the buffer matches. LED3 keeps blinking.
LED3 alone does not indicate success.

&par Hardware Description

Connect the two boards as follows, and connect GND together:

   SPI1      Master      Slave
   NSS       PA4         PA4
   SCK       PA5         PA5
   MISO      PA6         PA6
   MOSI      PA7         PA7

USART1 is used for the result log:
 - TX = PA9, baud rate 115200, 8 data bits, 1 stop bit, no parity

PA5/PA6/PA7 are free on this board in RMII Ethernet mode. Do not run an
Ethernet example at the same time. SPI2 is not used because PB12/PB13 are
the RMII transmit pins.

&par Directory contents

  - SPI/SPI_Polling/Source/main.c              Main program
  - SPI/SPI_Polling/Source/apm32f10x_int.c     Core exception handlers
  - SPI/SPI_Polling/Source/system_apm32f10x.c  System clock configuration
  - SPI/SPI_Polling/Include/main.h             Application definitions

&par IDE environment

  - MDK-ARM V5.36
  - EWARM V8.50.5.26295
  - Eclipse GNU Arm Embedded, configurations APM32F105 and APM32F107

&par Hardware and Software environment

  - This example runs on APM32F107 MINI devices.
