I am looking into the possibility of using an nRF5340DK to probe SPI pins. For context:
- There is a total of 3 devices in the system: the master and slave being used primarily for SPI, and this nRF as the prober
- I also ensure that all devices share the same GND.
- The SPI is configured in mode 0, uses a clock of about 4MHz, and is MSB first.
- To read register C from the slave device, master slave must do a transmit+receive (transceive) such that:
- For byte 1 that it transmits, 0x80 | C (where C is the register to read; for example, for register 4, transmit 0x84).
- For byte 2 that it transmits, it is ignored but usually 0x00
- For byte 1 that it receives, it is ignored but usually 0xFF
- For byte 2 that it receives, this is the register's value
The most luck I've had so far is based off the example at NCS v2.5.0 (modules\hal\nordic\nrfx\samples\src\nrfx_spim_spis\non_blocking). I've attached the project here - spi_sniffer_nordic_20250110.zip. But there is an issue where the read buffer reports data that isn't what the master device and logic analyzer reports. For example, when I read register 0x01, I expect the value 0x11 and get 0x02 on the nRF. I tried a couple other registers and the pattern I seem to see is that the nRF reports "double the register" (reading register 0x02 gives 0x04, register 0x2F gives 0x5E, etc). But I'm not sure why this is the case.
I've also tested out using SPIS as a secure peripheral, as I've gotten it working before (Periodic SPI reads in TF-M secure partition - Nordic Q&A - Nordic DevZone - Nordic DevZone). But when building, I keep getting errors saying 'TFM_SPIS3_IRQ_SIGNAL' undeclared (even though the .yaml file already defines SPIS3 in the mmio_regions and irqs). I think it stems from this warning - NRF_SPIS3_SECURE (defined at C:/ncs/v2.5.0/nrf\subsys\nonsecure\Kconfig.template.peripheral_secure:7) was assigned the value 'y' but got the value 'n'. But it has no direct dependencies according to nRF KConfig GUI, so I'm not sure why it keeps setting it to 'n'.
I don't have a preference of what approach, drivers, etc. are used; I'm just hoping to get it working as a prober/sniffer. I would appreciate whatever help regarding this issue. Thank you!