2017-11-20 08: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-interrupts2017-11-21 01: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
2017-11-21 01: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.
2017-11-21 04: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?