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

Nrfx timer issue

I try to set up a timer:

static const nrfx_timer_t m_timer = NRFX_TIMER_INSTANCE(0);

void timer_handler(nrf_timer_event_t event_type, void *p_context) {
}

void timer_init(void) {
    nrfx_timer_config_t timer_cfg = NRFX_TIMER_DEFAULT_CONFIG;
    timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
    ret_code_t err = nrfx_timer_init(&m_timer, &timer_cfg, timer_handler);
    APP_ERROR_CHECK(err);

    uint32_t ticks = nrfx_timer_ms_to_ticks(&m_timer, 1000);
    nrfx_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
    nrfx_timer_enable(&m_timer);
}

The nrfx_timer_init() function crashes with an error:

app_error_weak.c,   87, Application memory access: 228556:256

What is wrong? How to fix this?

Environment: nRF52840, NRF SDK 15.2, S140 6.1, Mesh SDK 2.2

Related