This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SWI user flags

Hello to all nordic jedi masters out there!

I am using nRF SDK v11.0 with the nRF52832.

I am a little bit confused about the usage/meaning of the flag argument in the nrf_drv_swi_trigger function.

Is it an arbitrary "context" variable I can use with any unsigned integer value? If so, then I have noticed that nrf_swi_flags_t is an alias for uint16_t but the flag argument of nrf_drv_swi_trigger is of uint8_t type.

Let me piggyback another question. I am using SD13.2 and the app_timer library. In order for me to use a SWI in my application, is it sufficient to define SWI_DISABLE0? If I don't, I get the error: "Symbol SWI0_EGU0_IRQHandler multiply defined (by app_timer.o and nrf_drv_swi.o)".

Thank you!

  • Hi,

    Yes, the flags are arbitrary "context" variable, it allows users to pass extra flags to SWI interrupt handler functions. Looks like nrf_swi_flags_t should have been a uint8_t. Regarding the SWI0_EGU0_IRQHandler symbol error, in SDK 11 app_timer uses SWI0_EGU0_IRQn, but you can change it to use SWI1_EGU1_IRQn instead. You can change this in app_timer.c :

    #elif defined NRF52
    #define SWI_IRQn SWI1_EGU1_IRQn
    #define SWI_IRQHandler SWI1_EGU1_IRQHandler
    #endif
    

    Regarding SWI_DISABLE0 you can read here that:

    To disable specific SWIs from the pool, add a global define during compilation (SWI_DISABLE0 to SWI_DISABLE5). Any disabled SWI will not be allocated and will therefore not be available to the user.

Related