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

Subscribe for io interrupt?

I have a basic question regarding a basic area. Interrupts! But without any good specification and how the OS work and good example how to do this I need to push for the obvious. So if you use an BLE stack and want to subscribe for an IO interrupt where you can registered a hook to be called when the interrupt occur, How do you do it? I have looked at GPIOTE, APP_GPIOTE, NRF_GPIO, APP_BUTTON but I never get any event even if the IO change level. I do not want to use any polled system or use any tick or timers. Pure INT as it should be used. Any advice!

  • you can use app_gpiote library to get events on pin interrupt. I think the sequence is something like this

    nrf_gpio_cfg_input(something something); 
    err_code = app_gpiote_user_register(register user your event handler when pin changes its state);
    APP_ERROR_CHECK(err_code);
    err_code = app_gpiote_user_enable(enable user);
    APP_ERROR_CHECK(err_code);
    

    There are no timers used in app_gpiote library, just GPIO, GPIOTE PORT functionality and interrupt handling. This is I guess what you need.

  • I did use this but it fails and I cannot explain why. After I run the debugger without changing any code it worked with execution in debug mode. I then restarted the hardware and run it none debug mode and it still worked. Cannot explain this behavior.

Related