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

How to get SPI Slave to work on NRF51-DK?

I have been trying to get the SPI Slave to work on an NRF51-DK for about a day now and I haven't been making any progress.

I first tried it with the softdevice enabled (which is needed for the final application) however I then thought that maybe that could be a problem. I therefore erased everything and relinked for a blank device.

This however did not solve the problem.

I tried getting the SPI Slave example to work with an Arduino Board as Master the results are more than strange.

The registers for the SPI device seem to set correctly. The pins are selected correctly and I have tried different ones.

The problem is that while SPI_SLAVE_XFER_DONE triggers event.rx_amount and event.tx_amount is always 0 even though using a logic analyzer I can clearly see that both MOSI and MISO clock stuff.

The strange part is that MISO always clocks 0x20 as the first byte (which is nowhere in the TX Buffer) and then follows this up by clocking 55 AA AA 55 55 AA AA 55 55 etc.

I already made sure that both master and slave use the same mode and bit ordering and frankly I'm at a complete loss now as to what I'm doing wrong.

I checked that the NRF51-DK is actually a slave by unplugging the clock pin which resultet in MISO flatlining. Also keeping theSlave Select pin HIGH will disable the NRF51-DK as expected.

I'm attaching the waveform that I got from my logic analyzer. Note that I implemented a 1ms delay between setting slaveselect to LOW and starting the clock. SPI Waveform.csv SPI Waveform.png

Related