nrfx 4.5.0
Loading...
Searching...
No Matches
SPIM with SPIS advanced non-blocking

SPIM with SPIS advanced non-blocking

The sample demonstrates an advanced functionality of nrfx_spim and nrfx_spis drivers operating in the non-blocking mode.

Requirements

The sample supports the following development kits:

Board Support
nrf52dk_nrf52832 Yes
nrf52833dk_nrf52833 Yes
nrf52840dk_nrf52840 Yes
nrf5340dk_nrf5340 Yes
nrf54l15dk_nrf54l15 Yes
nrf9160dk_nrf9160 Yes

‍Due to pin conflicts on the nRF54L15 DK, this example uses an alternate UART console.

Overview

Application initializes nrfx_spim and nrfx_spis drivers and starts operating in the non-blocking mode. MSG_TO_SEND_MASTER message from m_tx_buffer_master is transmitted to m_rx_buffer_slave. Simultaneously, MSG_TO_SEND_SLAVE message from m_tx_buffer_slave is transmitted to m_rx_buffer_master. When the transactions are completed both spim_handler() and spis_handler() are executed. The messages received are then read from m_rx_buffer_master and m_rx_buffer_slave.

‍For more information, see SPIM driver and SPIS driver - nrfx documentation.

Wiring

To run the sample correctly, connect pins as follows:

  • LOOPBACK_PIN_1A with LOOPBACK_PIN_1B,
  • LOOPBACK_PIN_2A with LOOPBACK_PIN_2B,
  • LOOPBACK_PIN_3A with LOOPBACK_PIN_3B,
  • LOOPBACK_PIN_4A with LOOPBACK_PIN_4B.

‍Refer to pin definitions in common/nrfx_example.h.

You should monitor the output from the board to check if it is as expected.

Building and running

To run this sample, build it for the appropriate board and then flash it as per instructions in Building and running section.

Sample output

You should see the following output:

- "Starting nrfx_spim basic non-blocking SPIM with SPIS example."
- "SPIM finished. Context passed to the handler: >Some context<"
- "SPIM rx buffer: Nordic"
- "SPIS finished. Context passed to the handler: >Some context<"
- "SPIS rx buffer: Semiconductor"