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

PPI TASKS_OUT to SWI when NRF_RADIO->EVENTS_DEVMATCH

We have implement a PPI for device match to trigger a GPIO toggle . but now we want to trigger a SW interrupt or a callback function .

my question is how to set PPI TASK when device match event occur .

          // Configure PPI channel with connection between EVENTS_DEVMATCH and GPIOTE->TASKS_OUT[0]

 

         NRF_PPI->CH[PPI_CHANNEL].EEP = (uint32_t)&NRF_RADIO->EVENTS_DEVMATCH;

         NRF_PPI->CH[PPI_CHANNEL].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0]; 

  I want to trigger a SWI to instead of this GPIO task

Parents
  • Hi,

    If you take a look at the RADIO INTENSET register, you can see that DEVMATCH has its own interrupt you can enable.

    For ESB, we are disabling all radio interrupts when we call nrf_esb_start_rx(), so make sure to enable the DEVMATCH interrupt after you call nrf_esb_start_rx().

    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);
    NRF_RADIO->INTENSET = RADIO_INTENSET_DEVMATCH_Msk;

    You should then modify the RADIO_IRQHandler in nrf_esb.c to check for DEVMATCH, and then call your handler function. Something like shown in this snippet:

    void RADIO_IRQHandler()
    {
        if (NRF_RADIO->EVENTS_READY && (NRF_RADIO->INTENSET & RADIO_INTENSET_READY_Msk))
        {
            NRF_RADIO->EVENTS_READY = 0;
            DEBUG_PIN_SET(DEBUGPIN1);
        }
    
        if (NRF_RADIO->EVENTS_DEVMATCH && (NRF_RADIO->INTENSET & RADIO_INTENSET_DEVMATCH_Msk))
        {
            NRF_RADIO->EVENTS_DEVMATCH = 0;
            // Your handler function code
        }

    If we for some reason want to handle the RADIO peripheral's ISR execution at a lower priority for the DEVMATCH event, an alternative approach would then be to use the EGU(Event generator unit) to trigger the interrupt instead.

Reply
  • Hi,

    If you take a look at the RADIO INTENSET register, you can see that DEVMATCH has its own interrupt you can enable.

    For ESB, we are disabling all radio interrupts when we call nrf_esb_start_rx(), so make sure to enable the DEVMATCH interrupt after you call nrf_esb_start_rx().

    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);
    NRF_RADIO->INTENSET = RADIO_INTENSET_DEVMATCH_Msk;

    You should then modify the RADIO_IRQHandler in nrf_esb.c to check for DEVMATCH, and then call your handler function. Something like shown in this snippet:

    void RADIO_IRQHandler()
    {
        if (NRF_RADIO->EVENTS_READY && (NRF_RADIO->INTENSET & RADIO_INTENSET_READY_Msk))
        {
            NRF_RADIO->EVENTS_READY = 0;
            DEBUG_PIN_SET(DEBUGPIN1);
        }
    
        if (NRF_RADIO->EVENTS_DEVMATCH && (NRF_RADIO->INTENSET & RADIO_INTENSET_DEVMATCH_Msk))
        {
            NRF_RADIO->EVENTS_DEVMATCH = 0;
            // Your handler function code
        }

    If we for some reason want to handle the RADIO peripheral's ISR execution at a lower priority for the DEVMATCH event, an alternative approach would then be to use the EGU(Event generator unit) to trigger the interrupt instead.

Children
No Data
Related