Disable interrupts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-20 8:47 PM
STMF4 is running and using some of the interrupts.
A a new piece of code needs to be protected from all interrupts but a specific one, which has the highest priority in this application.
The trivial solution:
Go through the entire NVIC, disable every interrupt which is enabled besides the mentioned one, remember these interrupts and at the end of the code enable those interrupts.
Is there a nicer solution ( RTOS is not used) ?
Maybe something that utilize the fact that it is the highest level interrupt?
Thanks,
#stm32-interrupts- Labels:
-
Interrupt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-21 1:00 AM
You can configure BASEPRI register with:
void __set_BASEPRI ( uint32_t basePri );
This allows you to disable all interrupts with priority level value bigger or equal to a given threshold.
See
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-21 1:14 AM
I suggest to go to
, and read/download the M4 technical reference manuals - especially the interrupt section.The ST manuals leave this out, usually.
Then read the F4 ref manual for specifics, and assign your interrupt priorities appropriately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-11-21 4:42 PM
Could you configure the preemption levels to create the fencing you want, use SCB->SHP to setup where the SVCHandler falls in the hierarchy and then execute the critical code via the SVC?
Up vote any posts that you find helpful, it shows what's working..
