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

Ble advertising and timer conflict

Hi

I would like to ask you for advice on how to solve my problem with Ble and the timer I have nRf52840 and I am trying to add a timer to examples\ble_peripheral\ble_app_uart timer works properly unless advertising_start(); and then the timer conflict with Ble begins. Does anyone have a solution to this problem ? I am adding part of the timer code and also photos where to see my problem.

#define GPIO_24       NRF_GPIO_PIN_MAP(0,24)

void timer_init(void)
{
    NRF_TIMER2->TASKS_STOP = 1;

    NRF_TIMER2->SHORTS    = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos);
    NRF_TIMER2->MODE      = TIMER_MODE_MODE_Timer;
    NRF_TIMER2->BITMODE   = (TIMER_BITMODE_BITMODE_24Bit << TIMER_BITMODE_BITMODE_Pos);
    NRF_TIMER2->PRESCALER = 1;  
    NRF_TIMER2->INTENSET  = (TIMER_INTENSET_COMPARE0_Set << TIMER_INTENSET_COMPARE0_Pos);

    NRF_TIMER2->CC[0]       = 100;

    NRF_TIMER2->TASKS_START = 1;
	NVIC_EnableIRQ(TIMER2_IRQn);
} 

void TIMER2_IRQHandler(void)
{
    if (NRF_TIMER2->EVENTS_COMPARE[0])
    {
       nrf_gpio_pin_toggle(GPIO_24);
	   NRF_TIMER2->EVENTS_COMPARE[0] = 0;
    }
}

not start advertising

start advertising

Parents Reply
  • Then you have three options:

    1. Not use the SoftDevice.
      If all you're going to do with BLE is to send periodic advertisements then you don't really need the SoftDevice, you can control the RADIO directly and send advertisements when you have available CPU time. 

    2. Use the PPI peripheral to create a state-machine that runs independently from the CPU, with the purpose of controlling the ADC.

    3. Use the SAADC peripheral instead. It has Direct Memory Access through EasyDMA, this means that you can run the SAADC independently from the CPU. 
Children
Related