What's the highest priority can I set for GPIOTE with Soft Device enabled?

Hi all,

I am new to BLE application development. Therefore, please go easy on me. I am working with an EVK-NINA-302 development kit (nRF52 Series SOC) and nRF5 SDK_17.1.0. 

In my application, I am trying to detect the presence of square wave pulses (frequency between 2 to 150 Hz) on one of the GPIO pins and send this information (1 = square waves present, 0 = no waves present) over BLE to other devices. At this time, I am using the nRFConnect app to receive data. 

Currently, GPIOTE interrupts priority is set to 6. I generate an interrupt when the signal on the GPIO pin goes from low to high and update the characteristic value. 

My application works fine if the square wave frequency is less than 20 Hz. It stops working when the frequency gets above 20 Hz and I start to get "FATAL ERROR". 

At this time, I am not understanding why my application stops working for a frequency higher than 20 Hz.

I am thinking changing the interrupt priority of GPIOTE may help. What's the highest priority that can be set for GPIOTE with Soft Device enabled? 

If you have come across this kind of issue, any help will be much appreciated.

Regards,

Paul

  • Hi Paul,

    My application works fine if the square wave frequency is less than 20 Hz. It stops working when the frequency gets above 20 Hz and I start to get "FATAL ERROR". 

    I suggest you start by finding more about this error. If you have logging enabled and also make a Debug build (is using a SES example project, just select the "Debug" build target. If using something else/other toolchain, define "DEBUG" and "DEBUG_NRF"). Then you should see the file name, line number and error code.

    I am thinking changing the interrupt priority of GPIOTE may help. What's the highest priority that can be set for GPIOTE with Soft Device enabled? 

    It seems premature to conclude that this is an issue of GPIOTE interrupt priorities, but if you like to increase the GPIOTE priority you can set it to as high as 2 (lower number means higher priority). See Interrupt priority levels from the SoftDevice specification. Note that you cannot SoftDevice API calls from this priority, and you should make sure to not spend much time in the ISRs.

Related