I've got some really simple code I've been trying to get working with SPI on nRF52 (while also using SoftDevice):
///MISO, MOSI, SCK set, but SS not
err_code = nrf_drv_spi_init(&spi0, &spi_config, NULL);
// and later, repeated calls to:
uint8_t tx = (uint8_t)data;
uint8_t rx = 0;
err_code = nrf_drv_spi_transfer(&spi0, &tx, 1, &rx, 1);
Now, I'm aware this is horrible, but right now I'm just trying to get something working with what I have at the moment (which expects a blocking SPI call), before moving to batching the data up.
I've shorted the two MOSI/MISO IO pins together and I write "Hello", one character at a time in quick succession using the above command.
With SPI0_USE_EASY_DMA 0 this works great and I get "Hello" back, but with SPI0_USE_EASY_DMA 1 I just get zeros back. I tried to align rx and tx on a 4 or 8 byte boundary in case it was a DMA issue but it was the same - although at some point I did manage to get "H\xC8l\xECo" or "\xEFe\xE5l\xEC" - so every other character was right.
Any ideas what might be the problem? I get no error codes, it does seem strange that this works perfectly without Easy DMA.
I believe you are experiencing Errata 58. You can confirm with a logic analyzer.
Aha - thanks! So this is present in nRF52832 Rev 1 - Is that likely to be in the chips that I'm using in production, or is just my PCS10040 V1.1.0 devkit?
nRF52832 Rev 1
It is very likely, it is the only revision that is production ready.
Ahh, then yes - I have 6k of them at the CM's :) Thanks again for the great help and advice.