Hi,
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.