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

What is the easiest way to disable all interrupts?

Using the nRF51822. I have a routine that should never be interrupted. What is the easiest way to disable all interrupts, and then re-enabling them?

Parents
  • I think sd_nvic_critical_region_enter() _exit() will not be helpful. Sometimes the reason which we need to disable all interrupts, in the MCU world, is to make a very short clock in GPIO by software. And in the this all-interrupt-disabled period, the GPIO clocks can made almost constantly, say, for 1us. The problem is, if we do not have such the API's to disable all interrupts, then the GPIO clocks cannot be made in this platform. As we have known in 8051, the instruction is simply 'EA=0'. In the nRF51822 platform, I think it is still possible to do such the API by setting 'cspie' registers; but it is usually can be used in the privileged mode...

    So is it possible that Nordic release which the 'disable-all-interrupts' API's for applications? We know it has potentials to make BLE disconnected; but if it is used properly, it will not be disconnected...

Reply
  • I think sd_nvic_critical_region_enter() _exit() will not be helpful. Sometimes the reason which we need to disable all interrupts, in the MCU world, is to make a very short clock in GPIO by software. And in the this all-interrupt-disabled period, the GPIO clocks can made almost constantly, say, for 1us. The problem is, if we do not have such the API's to disable all interrupts, then the GPIO clocks cannot be made in this platform. As we have known in 8051, the instruction is simply 'EA=0'. In the nRF51822 platform, I think it is still possible to do such the API by setting 'cspie' registers; but it is usually can be used in the privileged mode...

    So is it possible that Nordic release which the 'disable-all-interrupts' API's for applications? We know it has potentials to make BLE disconnected; but if it is used properly, it will not be disconnected...

Children
Related