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

Pulse generation on pin incorrect when sd in advertising mode

Hi,

I am trying to generate a constant 250ms pulse on a certain pin:

  NRF_TIMER0->MODE      = TIMER_MODE_MODE_Timer;
  NRF_TIMER0->BITMODE   = TIMER_BITMODE_BITMODE_16Bit;
  NRF_TIMER0->PRESCALER = 4;
  NRF_TIMER0->CC[0] = 25000;
  NRF_TIMER0->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Msk;
  int chNo = 0;
  nrf_gpiote_task_config(chNo, PIN_NO, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH);

  sd_ppi_channel_assign(chNo, &(NRF_TIMER0->EVENTS_COMPARE[0]), &NRF_GPIOTE->TASKS_OUT[chNo]);
  sd_ppi_channel_enable_set(1 << chNo);

  NRF_TIMER0->TASKS_START = 1;

but I see that the pulse is about 1s long when the BLE is in advertise mode. As soon as the device is connected with a host, the pulse generator behaves correctly. I am really puzzled about this behavior. Any help is appreciated!

Thanks! florin

Parents Reply Children
Related