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

Use app_gpiote with softdevice

Hi,

I would like to use the app_gpiote files from Nordic in combination with the softdevice enabled. In the app_gpiote.c file interrupts are enabled using the standard CMSIS functions (NVIC_EnableIRQ etc)

Do I need to replace the CMSIS interrupt functions in the app_gpiote file by the sd_nvic_*** functions from Nordic? The ble_app_alert_notification project uses the softdevice with the app_gpiote module but the sd_nvic functions are not used in that example. Is that correct? Or could it cause problems to use CMSIS interrupt functions with the softdevice enabled?

Parents
  • Hi Jos

    The general rule is that you should use the sd_* wrapper functions for all peripherals restricted by the softdevice when the softdevice is enabled, including the NVIC. However, if you look closely into e.g. the ble_app_bps example in the SDK, the gpiote_init() function is called before the softdevice is initialized with the ble_stack_init() call in the main function. The gpiote_init() calls the app_gpiote_init() which enables the gpiote interrupt by calling number of CMSIS functions. So in the SDK examples, the gpiote CMSIS functions are called before the softdevice is enabled. But if you choose to enable the gpiote interrupt after you initialize the softdevice, you should use the sd_nvic_* functions instead.

Reply
  • Hi Jos

    The general rule is that you should use the sd_* wrapper functions for all peripherals restricted by the softdevice when the softdevice is enabled, including the NVIC. However, if you look closely into e.g. the ble_app_bps example in the SDK, the gpiote_init() function is called before the softdevice is initialized with the ble_stack_init() call in the main function. The gpiote_init() calls the app_gpiote_init() which enables the gpiote interrupt by calling number of CMSIS functions. So in the SDK examples, the gpiote CMSIS functions are called before the softdevice is enabled. But if you choose to enable the gpiote interrupt after you initialize the softdevice, you should use the sd_nvic_* functions instead.

Children
No Data
Related