So, I am using the NRF51 as a SPI slave for an RPI3B+. On a logic analyzer and O-Scope the Pi is sending its MOSI SPI data perfectly fine. On top of this issue the nrf_drv_spis_buffers_set call will only return '.' into my rx_buffer no matter what data the Pi sends. It also returns a success error code. I do not understand why I cannot get the NRF51 to load or receive the correct single byte data value sent from the RPI zero. Any ideas? It waits for the event correctly, handles what is sent when the Pi sends it, says it was successful, but then just sets a '.' to the rx_buffer no matter what the Pi sends it. I know this because I have the NRF51 sending my laptop values using UART to USB, and that works perfectly fine (been using it to send strings back and forth with no issue).
Here is my SPI configuration code:
nrf_drv_spis_config_t spi_config = NRF_DRV_SPIS_DEFAULT_CONFIG; //Set up the UART UART_Setup(); SPI_Setup(&spi_config);
void SPI_Setup(nrf_drv_spis_config_t * config) { config->csn_pin = APP_SPIS_CS_PIN; config->miso_pin = APP_SPIS_MISO_PIN; config->mosi_pin = APP_SPIS_MOSI_PIN; config->sck_pin = APP_SPIS_SCK_PIN; config-> bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST; config->mode = NRF_DRV_SPIS_MODE_3; APP_ERROR_CHECK(nrf_drv_spis_init(&SPI, config, spis_event_handler)); }
Here is my SPI set call:
err_code = nrf_drv_spis_buffers_set(&SPI, &tx_test, 1, rx_buffer, 1); while (!spis_xfer_done) __WFE();
Finally here is my handler:
void spis_event_handler(nrf_drv_spis_event_t event) { //If the event states the SPI transfer is done if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) spis_xfer_done = true; }
Pretty straightforward based on the SPIS example in SDK12.3
Ory