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

SPI slave read without debugger

I am using nRF52840 DK as a SPI slave with an external MCU configured as SPI master. The SPI clock frequency is set to 1 MHz. I am using the following pins for SPI:

P0.29 - SPIS_CS_PIN P0.28 - SPIS_MISO_PIN P0.4 - SPIS_MOSI_PIN P0.3 - SPIS_SCK_PIN

Using the SPI slave driver in SDK 13.0.0 and S140 softdevice, I am seeing the SPI read is failing when the debugger is detached. SPI_XFER_DONE event does not happen. I am using a timer for SPI_XFER_DONE timeout purposes so that it does not get stuck waiting for SPI completion. The timeout is set to 100 millisecs (larger timeouts does not make any difference).

I start my SPI communication without debugger connection and I notice failures. Then in the middle of my test, I attach the debugger to running target and then communication is successful. Then as soon as I detach, the communication starts to fail again.

I am using IAR 8.11.1 as my IDE and segger J-Link as my debugger. The same behavior is seen if I use IAR I-Jet as my debugger also.

EDIT: 06/28/2017: If the low power mode was disabled (by commenting out sd_app_evt_wait() ), then this issue goes away. Setting constant latency mode to 1 did not make any difference. See attached code in the comments section.

Related