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

nrf52 disable interrupt below a certain level

My goal is that disabling the interrupts other than soft device interrupt.

I think that this is achieved by disabling interrupts below a certain level (in this case, 2?), is this possible?

Or I suppose that to set the current interrupt priority state high is another solution, but I couldn't find the method to realize this, either.

Please tell me sample codes to realize those. 

 

Parents
  • Hi,

     

    When the softdevice is present, you can use the macro's CRITICAL_REGION_ENTER and CRITICAL_REGION_EXIT to disable all application interrupts.

    This macro will expand to call app_util_platform.c::app_util_critical_region_enter(), which will leave all softdevice interrupts still enabled.

     

    Kind regards,

    Håkon

  • Thank you for your reply.  And sorry for the lack of information, but I want to allow only ble stack interrupt, so those functions can not be used.

  • k.k said:
    but I want to allow only ble stack interrupt, so those functions can not be used.

    The functions will disable all interrupt vectors that belong to the application, and keep the softdevice owned vectors still enabled.

    Isn't this what you want?

     

    Kind regards,

    Håkon

  • When i used CRITICAL_REGION_ENTER/EXIT functions, and excecuted a little bit time consuming process in this region, an error handler from ble_stack was called. I want to do time consuming process without any interrups from peripherals.

  • I found that the error handler is from `sd_softdevice_enable` (the second argument callback function is called). If CRITICAL_REGION_ENTER/EXIT is used and after a certain period of time in this region, the error handler is called.

    I thought that the cause of the error handler  is called is that some of the important interrupts of softdevice or anything else modules are disabled for a long time, is it correct?

    If so, I thought that disabling interrupts below a certain level is one of the best solution, but I couldn't find the corresponding API.

  • The problem has solved, the cause is our software bug (SOFTDEVICE_PRESENT definition is disabled.).

    Thanks to your advice, I tried to watch inside the CRITICAL_REGION_ENTER function and could find this bug. Thank you so much.

    But I still want to know how to realize following 2 methods;

    1. change current interrupt level 
    2. disable interrupt below a certain level
  • Hi,

     

    Glad to hear that you found the source of the initial issue.

    k.k said:
    I thought that the cause of the error handler  is called is that some of the important interrupts of softdevice or anything else modules are disabled for a long time, is it correct?

    I know that you're already found this issue, but: this is a side-effect of when you're re-enabling interrupts again where you get many events triggered at the same time.

    The softdevice has a predictive order of events, and when things happen out-of-order, it detects and asserts.

     

    k.k said:

    If so, I thought that disabling interrupts below a certain level is one of the best solution, but I couldn't find the corresponding API.

    There is no API for this, you need to parse each interrupt and check manually.

     

    k.k said:
    change current interrupt level

     Do you mean exit the interrupt handler? I am not sure I understand really what you want to obtain here.

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Glad to hear that you found the source of the initial issue.

    k.k said:
    I thought that the cause of the error handler  is called is that some of the important interrupts of softdevice or anything else modules are disabled for a long time, is it correct?

    I know that you're already found this issue, but: this is a side-effect of when you're re-enabling interrupts again where you get many events triggered at the same time.

    The softdevice has a predictive order of events, and when things happen out-of-order, it detects and asserts.

     

    k.k said:

    If so, I thought that disabling interrupts below a certain level is one of the best solution, but I couldn't find the corresponding API.

    There is no API for this, you need to parse each interrupt and check manually.

     

    k.k said:
    change current interrupt level

     Do you mean exit the interrupt handler? I am not sure I understand really what you want to obtain here.

     

    Kind regards,

    Håkon

Children
No Data
Related