We are writing SPI drivers for RF chip and blocked on the below issue.
The issue we are facing is the Chip Select line is not active(active low) until the TX transaction is completed.
We are using EVENT_READY (function : nrf_spi_event_check) to check TX event completion for de-assertion of Chip Select line.
Below is the output taken from the scope and the code
Can you please let us know where we are going wrong?
The Yellow line (top one) is the Chip Select and the Green(bottom one) is the data line with 2 bytes being sent
uint8_t rf_spi_send(void) { /* Select Slave active low */ nrf_gpio_pin_clear(NRFX_SPIM_SS_PIN); nrf_spi_event_clear(RF_SPI,NRF_SPI_EVENT_READY); /* Transfer SPI Data */ nrf_spi_txd_set(RF_SPI,0xAA); nrf_spi_txd_set(RF_SPI,0x55); rx_byte = nrf_spi_rxd_get(RF_SPI); rx_byte = nrf_spi_rxd_get(RF_SPI); while(nrf_spi_event_check(RF_SPI, NRF_SPI_EVENT_READY) != true); nrf_gpio_pin_set(NRFX_SPIM_SS_PIN); return 0; }