Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why is there a "nrf_delay_ms(200);" in the SPI Master example in SDK 16.0 ?

Hi, I was just wondering why there is a "nrf_delay_ms(200);" in the SPI Master example in SDK 16.0.

Here is the code in the main function where it is located :

while (1)
{
// Reset rx buffer and transfer done flag
memset(m_rx_buf, 0, m_length);
spi_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length));

while (!spi_xfer_done)
{
__WFE();
}

NRF_LOG_FLUSH();

bsp_board_led_invert(BSP_BOARD_LED_0);
nrf_delay_ms(200); //Here it is !
}

When I comment it, the code is still working. I do not know if it helps for the answer but I'm running on nrf52810.

Thanks in advance !

Related