Hi,
I'm trying to get SPI (master) to work (nRF51822) for communicating with a quadrature counter (LS7366R). I've read several implementations of SPI master, such as the one in RFduino and the mbed library, and I've read the reference manual.
After a few bytes of exchange, the communication hangs waiting for EVENTS_READY to turn 1. See the while loop below in my code. Sometimes it happens on the first byte, and sometimes after a few more. The data I get back is all 0xFF, which isn't correct, but that might be unrelated.
Here's the code. device->module is set to NRF_SPI0.
uint8_t tfspi_transmit(tfspi_device_t *device, uint8_t byte) {
device->module->TXD = byte;
while (device->module->EVENTS_READY == 0); // Infinite loop here
device->module->EVENTS_READY = 0;
uint8_t readByte = device->module->RXD;
return readByte;
}
Maybe this is something someone has seen before? Thanks for your help!