SPI Driver Example Source Code Reference

This file contains the API that implements the SPI master driver example functionalities.

This file contains sample source codes to demonstrate the SPI Foundation Services APIs.

For this example application to work the following needs to be done:
  1. 1.Configure the SPI module as follows:
    • Enable SPI: ticked
    • Modes: Master
    • Interrupt driven: unticked
    • Configure other settings as desired.
    • Select TX and RX pins in Pin Manager: Grid View.
  2. 2.Make loop back connection to MISO and MOSI or connect SPI pins to a slave
  3. 3.If connected to a slave, assign CS pin and add the necessary calls in drive_slave_select_low() and drive_slave_select_high()
  4. 4.Program the slave device to exchange the string "data"
  5. 5.Call SPI_Master_test from main()
This example works like this:
  1. 1.Upon reset, the application will transmit a string "data" and read the same number of bytes back.
  2. 2.The program will then compare the received string with "data". Returns 1 to indicate a match or 0 if not.