Dear Members,
How can I GetTick from the CPU? similar to HAL_GetTick() ?
nrf_drv_systick_get ?
Thanks
Dear Members,
How can I GetTick from the CPU? similar to HAL_GetTick() ?
nrf_drv_systick_get ?
Thanks
Hello,
That is not that trivial. What do you intend to use this for? Do you want to measure something in ms? If so, what you need to do is to start either a timer or an rtc.
If you want to create a timer with a timeout, then you can use e.g. the app_timer.
What sort of resolution do you need? minutes? seconds? ms? µs?
I recommend that you check out the app_timer, which is used e.g. in the example ble_app_hrs.
Look at how battery_level_meas_timeout_handler() which is a timeout handler is set up to time out every 2 seconds.
If you set up and start the app_timer, you can also use the function app_timer_cnt_get() to get the tick number for the RTC (in fact, it uses the function drv_rtc_counter_get(), which you mentioned). But please note that the amount of time that these ticks represents depends on how the RTC is set up (frequency and prescaler)
Also, this function app_timer_cnt_diff_compute() or drv_rtc_counter_get() only works if the RTC (and app_timer in the app_timer case) is initialized and started.
Best regards,
Edvin
Hello,
That is not that trivial. What do you intend to use this for? Do you want to measure something in ms? If so, what you need to do is to start either a timer or an rtc.
If you want to create a timer with a timeout, then you can use e.g. the app_timer.
What sort of resolution do you need? minutes? seconds? ms? µs?
I recommend that you check out the app_timer, which is used e.g. in the example ble_app_hrs.
Look at how battery_level_meas_timeout_handler() which is a timeout handler is set up to time out every 2 seconds.
If you set up and start the app_timer, you can also use the function app_timer_cnt_get() to get the tick number for the RTC (in fact, it uses the function drv_rtc_counter_get(), which you mentioned). But please note that the amount of time that these ticks represents depends on how the RTC is set up (frequency and prescaler)
Also, this function app_timer_cnt_diff_compute() or drv_rtc_counter_get() only works if the RTC (and app_timer in the app_timer case) is initialized and started.
Best regards,
Edvin
or , how to use this function ? nrf_drv_systick_get()
nrfx_systick_get(nrfx_systick_state_t * p_state) , what's nrfx_systick_state_t * p_state ?
Thanks