How do i use SysTick for NRF52840 using nRF Connect SDK v2.0.0

I want to keep perform some task periodically .. probably using tick timer of every 1 ms, so that only after every 4000ms, i can perform some task.

How do i implement it ?

Any API / example i can refer to ?

Parents Reply
  • Hi Deep,

    This is quite late, BUT in kernel.h you will also find uint32_t k_uptime_get() which returns you the milliseconds since boot.  This will won't be affected by changes to the SysTick configuration presumably.

    Craig 

    /**
     * @brief Get system uptime.
     *
     * This routine returns the elapsed time since the system booted,
     * in milliseconds.
     *
     * @note
     *    While this function returns time in milliseconds, it does
     *    not mean it has millisecond resolution. The actual resolution depends on
     *    @kconfig{CONFIG_SYS_CLOCK_TICKS_PER_SEC} config option.
     *
     * @return Current uptime in milliseconds.
     */
    static inline int64_t k_uptime_get(void)
    {
    	return k_ticks_to_ms_floor64(k_uptime_ticks());
    }

Children
No Data
Related