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

Reading more than events with GPIOTE using high accuracy?

I'm using SDK 15.2

I'm trying to read two separate events configure in two separate pins (PIN_1 and PIN_2) with two different handlers (handler_1 and handler_2), like this:

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

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;

const auto err_code = nrf_drv_gpiote_in_init(PIN_1, &in_config, handler_1);

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(PIN_1, true);

const auto err_code = nrf_drv_gpiote_in_init(PIN_2, &in_config, handler_2);

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(PIN_2, true);


But in that way, only the event that was configured first works. In other words, if the event for PIN_1 is configured first it works, but just that event.
If event for PIN_2 is configured first it works, but just that event.

When I was debugging I've found out that nrfx_gpiote_irq_handler is not even called for the event that was configured last, so it might be some configuration problem

Am I missing something here?

Thanks!

Parents
  • Just a note, I'm a colleague of Jose. After reading the NRF_GPIOTE->CONFIG[x] register we found the following results about the above code snippet:

    CONFIG[0] associated with PIN_1 had the correct MODE field = 1/Event

    CONFIG[1] associated with PIN_2 had the incorrect MODE field = 3/Task

    Manually rewriting CONFIG[1] to set MODE to 1/Event fixed the problem, but why is this occurring in the first place? This only seems to happen to the second time nrf_drv_gpiote_in_init is called. Have not tested further calls of that function to see if this behavior continues.

Reply
  • Just a note, I'm a colleague of Jose. After reading the NRF_GPIOTE->CONFIG[x] register we found the following results about the above code snippet:

    CONFIG[0] associated with PIN_1 had the correct MODE field = 1/Event

    CONFIG[1] associated with PIN_2 had the incorrect MODE field = 3/Task

    Manually rewriting CONFIG[1] to set MODE to 1/Event fixed the problem, but why is this occurring in the first place? This only seems to happen to the second time nrf_drv_gpiote_in_init is called. Have not tested further calls of that function to see if this behavior continues.

Children
No Data
Related