nrf_delay_ms clock issues

I'm using nrf_delay_ms in main on "ble_app_beacon", but the delay time is much longer than I set.

I have set 2000ms delay to log, but it seems 4s or longer than I set.

int main(void)
{
	uint32_t num=0;
    // Initialize.
    log_init();
    timers_init();
    leds_init();
    power_management_init();
    ble_stack_init();
    advertising_init();

    // Start execution.
    NRF_LOG_INFO("Beacon example started.");
		NRF_LOG_FLUSH();
    advertising_start();

    // Enter main loop.
    for (;; )
    {
			nrf_delay_ms(2000);
			NRF_LOG_INFO("beacon test %d",num);
			NRF_LOG_FLUSH();
			num++;
        idle_state_handle();
    }
}

Parents Reply
  • Thanks!

    I have another question about HW driver(SPIM).

    For example, I want to send register address to recieve some data.

    APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, &addr_burst, 1, pReadBuff, ReadSize))

    I thought the 'pReadBuff' is correct,but pReadBuff[0] is 0x00 and the data starting from pReadBuff[1] will be wanted data.

    So I have to modify like this.

    APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, &addr_burst, 1, pReadBuff-1, ReadSize+1))

Children
Related