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

Timer1 max value

Hello,

I'm working on nrf52832-DK with SDK11 on Timer1. I can't use TIMER0 because I'm using also the softdevice.

My code source is :

//handler
void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
{
    
    switch(event_type)
    {
        case NRF_TIMER_EVENT_COMPARE1:
                  nrf_drv_gpiote_out_set(PIN_06);
         //nrf_drv_timer_compare_int_disable(&TIMER, NRF_TIMER_CC_CHANNEL0);


            break;
        
        default:
            //Do nothing.
            break;
    }    
}


main : 

                    time_us = 5000; //Time(in us) between consecutive compare events.
                    nrf_drv_timer_clear(&TIMER);
                    time_ticks = nrf_drv_timer_us_to_ticks(&TIMER, time_us);
                    nrf_drv_timer_compare(&TIMER_LED, NRF_TIMER_CC_CHANNEL1, time_ticks, true);
                    nrf_drv_timer_enable(&TIMER);

I want to configure my Timer1 between 1us and 10000us. I have seen that Timer 0 is BIT_WIDTH 16 bits so the maximum value can be theorically 65535 ?

But my timer restart at the value of 4097. Is it normal ? How can I configure it to set the value from 0-10000 us ?

Thank you very much

Related