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

Event vs Interrupt

Hi All,

I am developing a data acquisition system in which my device generates an interrupt for every 5ms upon its data is ready. I store one second long data in local buffer and write it into external flash memory every 1 second. 

I am bit confused with GPIO events and interrupts in nRF. I guess any level change on a input pin is called an event in nRF. If that is true I would like to configure one GPIO as input and configure an event (High to Low in my case) then assign it to an event handler. 

And then, I have read below lines in SDK documentation, 

When a SoftDevice is enabled, it can interrupt the application at any time for a certain amount of time. This can lead to the situation where some pin level changes are missed. If the application must track an input pin that can change its level frequently, PPI should be used with a high-accuracy event together with a TIMER in counter mode to count the detected transitions.

Below are my queries:

  1. My interrupt is generated every  5ms infinitely, and I cannot afford any single interrupt to lose. I would like to know how can I configure my interrupt handling mechanism to avoid data loss? 
  2. If I use PPI with Timer to count the interrupts I have missed from my peripheral, how can I retrieve data from my device at later point? 
  3. What is a softdevice? how it can interrupt the application? 
  4. I need some help understanding event. Previously i was using a processor where any GPIO can be configured for external interrupts which is very straight forward. In nRF it seems there is no interrupt concept for GPIO rather they call it as event. 

Any help would be highly appreciated. 

Regards

Laskhmi

Parents
  • Hi Laskhmi,

    My interrupt is generated every  5ms infinitely, and I cannot afford any single interrupt to lose. I would like to know how can I configure my interrupt handling mechanism to avoid data loss? 

    5 ms is quite a long time, so it should not be a problem to ensure that you never miss any of these interrupts. However, it might be that the interrupt processing is delayed a bit, but that may not be a problem? You can refer to the Interrupt model and processor availability in the SoftDevice documentation to see the maximum time the SoftDevice will delay the application, and as you see that is in any case significantly less, giving you a lot of margin.

    If I use PPI with Timer to count the interrupts I have missed from my peripheral, how can I retrieve data from my device at later point? 

    That depends on the peripheral. But I do not see this a likely problem since the frequency of the interrupt is so slow. 

    What is a softdevice? how it can interrupt the application? 

    A SoftDevice is Nordic's proprietary BLE stack. It needs to have the highest interrupt priority since Bluetooth has strict timing requirements, and several low-level radio interrupts need to be serviced in a timely manner.

    I need some help understanding event. Previously i was using a processor where any GPIO can be configured for external interrupts which is very straight forward. In nRF it seems there is no interrupt concept for GPIO rather they call it as event. 

    You can think of interrupts and events in the same way. When the application gets a. SoftDevice event, it is actually a software interrupt. And when there is a pin change interrupt form a GPIO, the SDK driver you typically use will have it's interrupted routine run, and this will call the applications event handler in the interrupt context. So it is in practice the same. (If you look at the terms used in the ARM documentation, you will also see interrupts and events used. In this case, it is also essentially the same, but some minimal differences. In the nRF peripheral HW context, the difference is bigger, since you can have HW events that trigger interrupts or not, depending on the configuration. But that is probably not relevant for your question in this case.)

Reply
  • Hi Laskhmi,

    My interrupt is generated every  5ms infinitely, and I cannot afford any single interrupt to lose. I would like to know how can I configure my interrupt handling mechanism to avoid data loss? 

    5 ms is quite a long time, so it should not be a problem to ensure that you never miss any of these interrupts. However, it might be that the interrupt processing is delayed a bit, but that may not be a problem? You can refer to the Interrupt model and processor availability in the SoftDevice documentation to see the maximum time the SoftDevice will delay the application, and as you see that is in any case significantly less, giving you a lot of margin.

    If I use PPI with Timer to count the interrupts I have missed from my peripheral, how can I retrieve data from my device at later point? 

    That depends on the peripheral. But I do not see this a likely problem since the frequency of the interrupt is so slow. 

    What is a softdevice? how it can interrupt the application? 

    A SoftDevice is Nordic's proprietary BLE stack. It needs to have the highest interrupt priority since Bluetooth has strict timing requirements, and several low-level radio interrupts need to be serviced in a timely manner.

    I need some help understanding event. Previously i was using a processor where any GPIO can be configured for external interrupts which is very straight forward. In nRF it seems there is no interrupt concept for GPIO rather they call it as event. 

    You can think of interrupts and events in the same way. When the application gets a. SoftDevice event, it is actually a software interrupt. And when there is a pin change interrupt form a GPIO, the SDK driver you typically use will have it's interrupted routine run, and this will call the applications event handler in the interrupt context. So it is in practice the same. (If you look at the terms used in the ARM documentation, you will also see interrupts and events used. In this case, it is also essentially the same, but some minimal differences. In the nRF peripheral HW context, the difference is bigger, since you can have HW events that trigger interrupts or not, depending on the configuration. But that is probably not relevant for your question in this case.)

Children
No Data
Related