This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52 timer capture returns 16-bit even when in 32-bit mode

I'm trying to read the 32-bit value of TIMER1, but it seems the value I read is always 16-bit value. When I debug the value is never above 0xFFFF.

snippet from nrf_drv_config.h

#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_62500Hz
#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW

init and read code

const nrf_drv_timer_t _nrf_timer = NRF_DRV_TIMER_INSTANCE(1);

uint32_t get_runtime_count() {
    return nrf_drv_timer_capture(&_nrf_timer, 1);
}

void timer_init( void ) {
    ret_code_t ret = nrf_drv_timer_init(&_nrf_timer, NULL, NULL);
    nrf_drv_timer_enable(&_nrf_timer);
}
Parents Reply Children
No Data
Related