Enable\Disable Interrupts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2008-07-29 10:01 AM
Enable\Disable Interrupts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 3:40 AM
Is there a quick way to temporarily disable and enble the interrupts on the Cortex? I have a critical timing loop which varies in time due to USB, DMA, and other interrupts. Is there a way to suspend interrupts for a few microseconds? I have worked with other ST parts (like the ST7) that had assembly instructions to perform this task. I am unable to find this info in the datasheet.
Thanks in advance.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 3:40 AM
''cpsid i'' disables interrupts, ''cpsie i'' re-enables them. Another option is to modify the BASEPRI register.
regards, Giovanni --- ChibiOS/RT- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 3:40 AM
You can use the PRIMASK register. When it is set to 1, it disable all
exception except hard fault exception and NMI exception. To do this, you can use assembler instruction CPSID I or MOVS r0, #1 MSR PRIMASK, r0 ; move R0 into PRIMASK To re-enable interrupt, you can use CPSIE I or MOVS r0, #0 MSR PRIMASK, r0 If you use RealView Compiler, or KEIL RealView Microcontroller Development Kit, you can use C functions __disable_irq(); and __enable_irq(); (http://www.keil.com/support/man/docs/armccref/armccref_cjafbcbb.htm) Or if you are using the ST firmware library, you can use the functions defined in cortexm3_macros.h void __SETPRIMASK(void); // disable interrupts void __RESETPRIMASK(void); // enable interrupts or functions in stm32f10x_nvic.h void NVIC_SETPRIMASK(void); // disable interrupts void NVIC_RESETPRIMASK(void); // enable interrupts which I believe has the same functions.