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

Cannot capture high speed (115Khz) GPIOTE interrupts [without ppi]

I tried to use pin_change_example in SDK to catch Interrupts (at first line) but I'm missing lots of them, I don't want to use PPI mechanism I just want to run my ISR in time.

Is it possible? I spent my 3 weeks to find a solution but there is nothing.. Please help me .

Thanks

Source code:


#include <stdbool.h>
#include "nrf.h"
#include "nrf_drv_gpiote.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "boards.h"
#define PIN_SCL 26
#define PIN_OUT2 28




void in_pin_scl_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_set(PIN_OUT2);
    nrf_gpio_pin_clear(PIN_OUT2);
    
}

static void gpio_init(void)
{
    ret_code_t err_code;

    if(!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }
   

    nrf_drv_gpiote_in_config_t in_config2 = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    in_config2.pull = NRF_GPIO_PIN_PULLUP;


    err_code = nrf_drv_gpiote_in_init(PIN_SCL, &in_config2, in_pin_scl_handler);
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_in_event_enable(PIN_SCL, true);

    nrf_gpio_cfg_output(PIN_OUT2);
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpio_init();

    while (true)
    {
        
    }
}


/** @} */

Config file is almost the same with pin_change_int. I tried changing

GPIOTE_CONFIG_IRQ_PRIORITY
GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS

It wasn't successful.

Parents
  • I want to run my own logic in in_pin_scl_handler that's why I cannot use PPI.  What can I do?

  • Hello,

    Could you elaborate some more on how you are measuring how many of the interrupts you are missing?
    Is the second line of the included plot the PIN_OUT2?
    Also, if I may ask, what are you going to control / do with the interrupt? Depending on what you will use the interrupt for, PPI may considerably reduce the CPU time required to handle your interrupts.

    What did you change the two defines from sdk_config.h to? What are their current values?
    GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is applicable to number of PORT events ( low-accuracy GPIOTE interrupts, using the SENSE feature of the GPIO module ).

    I noticed that you have clicked "Verified answer" on your comment, which indicates that the comment answered your question. I recommend only using the "Verified answer" button when a comment indeed answers the question you had.

    Best regards,
    Karl

Reply
  • Hello,

    Could you elaborate some more on how you are measuring how many of the interrupts you are missing?
    Is the second line of the included plot the PIN_OUT2?
    Also, if I may ask, what are you going to control / do with the interrupt? Depending on what you will use the interrupt for, PPI may considerably reduce the CPU time required to handle your interrupts.

    What did you change the two defines from sdk_config.h to? What are their current values?
    GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS is applicable to number of PORT events ( low-accuracy GPIOTE interrupts, using the SENSE feature of the GPIO module ).

    I noticed that you have clicked "Verified answer" on your comment, which indicates that the comment answered your question. I recommend only using the "Verified answer" button when a comment indeed answers the question you had.

    Best regards,
    Karl

Children
No Data
Related