nRF5 SDK  v14.0.0
Choose documentation:
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
SPI Slave Example

The SPI Slave Example demonstrates the use of the SPIS peripheral. It uses the SPI slave driver.

In the main loop, the application prepares the SPIS for a transfer and waits until the transfer is completed. Every time a transfer is completed, the LED is toggled.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\spis

Hardware configuration:

  • Slave SCLK pin must be connected to Master SCLK.
  • Slave CS pin must be connected to Master CS.
  • Slave MOSI pin must be connected to Master MOSI.
  • Slave MISO pin must be connected to Master MISO.

The default pin assignments for the SCLK, MOSI, and MISO lines can be found in sdk_config.h. The default pin assignment for the CS pin can be found in main.c.

Testing

Test the SPI Slave Example application by performing the following steps:

  1. Compile and program the application.
  2. Observe that no LED is toggled.
  3. Connect the board to another board that runs the SPI Master Example.
  4. Observe that the LED is toggled every 200 ms.