Hi there.
I'm using nRF5 SDK 17.1.0 with nrf52840.
I've configured my timer3 to interrupt by compare with 10us ticks. When it does, I toggle a pin. But when I measure the high and low periods of the pin with osciloscope, high period is shorter than low (high=8.4 us, low=11.6 us) , and I don't know what may be happening.
Does anyone know why it's happening?
#define OUTPUT_3_PIN NRF_GPIO_PIN_MAP(0,13)
void Gpio_Config(void){
nrf_gpio_cfg_output(OUTPUT_3_PIN);
}
void TimerSpeed_Config(void){
uint32_t time_ticks;
uint32_t err_code = NRF_SUCCESS;
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init(&TIMER3, &timer_cfg, Timer3_EventHandler);
APP_ERROR_CHECK(err_code);
time_ticks = nrf_drv_timer_us_to_ticks(&TIMER3, 10);
nrf_drv_timer_extended_compare(&TIMER3, NRF_TIMER_CC_CHANNEL3, time_ticks, NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK, true);
nrf_drv_timer_enable(&TIMER3);
}
void Timer3_EventHandler(nrf_timer_event_t event_type, void* p_context){
switch (event_type){
case NRF_TIMER_EVENT_COMPARE3:
{
nrf_gpio_pin_toggle(OUTPUT_3_PIN);
}
}
}