2015-07-07 11:47 AM
Hi all,
I am using STM32F407 chip with GCC toolchain. I have a trouble with my code. I wrote a function that needs an exclusive access to variables (I want to have ability to call this function from interrupts as well as from main loop code), so I am disabling interrupts whenever code reaches critical sections. The thing is that whenever I am using disable_irq()/enable_irq() functions, interrupts sporadically do not get turned on again and stay disabled (PRIMASK = 1). I am still while developing and debugging my code but I would like to ask if there any other possibility for PRIMASK to get set to 1 other than using ''asm volatile (''cpsid i'');'' line? I was looking into datasheet/reference/programmers manuals, but so far no luck. #stm32f42015-07-07 01:29 PM
Seem to recall it's not something that's inherently stacked by the processor on the Cortex parts.
I guess if you used a mutex, or provided some sort of audit trail you might be able to figure out who failed to re-enable. If you're using an RTOS, it could stack things. Look also for MSR usage. You'd also want to make sure you've covered all exit paths from a routine. Again, some sort of audit trail might permit you to track any commonality in the failure.2015-07-08 01:13 AM
You were right. I have checked my code again and there was a possibility for it to exit before re-enabling interrupts back again. Silly mistake. Thank for a clue!