This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Use another nrf52840 to eavesdrop on the master and slave communicating with SPI

My stm32 (as a master) uses SPI to communicate with nrf52840 (as a slave)
When my nrf52840 wants to send data to stm32, it will pull a GPIO to let stm32 generate a GPIO interrupt to read the data transmitted by nrf52840

Now I want to use another listen_nrf52840 (as a sniffer) to receive the data transmitted by both of them in parallel.
The SPI pin of my listen_nrf52840 is the same as the SPI slave, but it can only receive data from the master, as shown below

However, when I swap the MOSI and MISO pins of listen_nrf52840, I can receive the data sent by the SPI slave.
As shown below

Kind of like what a logic analyzer is doing

Can I change the pin number of listen_nrf52840 during operation?
Or is there any way for the SPI slave to receive data from another SPI slave and master at the same time ?

Thanks in advanced,

Poyi

  • Sorry. I meant the SCK (SPI clock pin).

    And yes. You need to use SPI instance 0 for one of the SPIs and SPI instance 1 for the other.

    In sdk_config.h you need to enable both instance SPI0 and SPI1. SPI0 is probably enabled by default, but not SPI1. I have to go now (in a hurry), but look for the non-NRFX definitions for SPI, and find where SPI0 is set. Set SPI1 in the same way.

    Have a nice weekend!

    Best regards,

    Edvin

Related