cstm32interruptcortex-m

Can I service the SysTick interrupt while already in HSEM interrupt (STM32H745, M4 core)?


I have a situation where my software enters a HSEM interrupt (with the M4 core) and while it is servicing that interrupt it is ignoring the SysTick interrupt. Exiting the HSEM interrupt is dependent on 1ms ticks getting counted from the SysTick interrupt so it gets stuck in the HSEM interrupt.

Is it possible to configure the MCU so that the SysTick interrupt will still run while the program is in another interrupt? Is this bad practice and should I just be writing the code so that exiting the HSEM interrupt isn't dependent on the SysTick interrupt getting called (I would prefer not to do this)?


Solution

  • As pointed out by 0___________, your program design is likely seriously flawed if you ran into a problem like this, and you should look into your interrupt handler length. However, this is also a good learning opportunity, so here is some info on SysTick handler priority.

    Yes, you can control the priority of the SysTick interrupt relatively to other interrupts.

    SysTick is technically an exception, not an interrupt. Other such exceptions include, but are not limited to BusFault, UsageFault, HardFault, System Reset and so on. They don't have IRQ numbers, and their configuration is not managed via NVIC. Their handlers' addresses are in the vector table before all the IRQn handlers. System exceptions are managed via SCB core peripheral, where, just like with regular interrupts in NVIC, you can set handler priority and other configs.

    Here is a piece from the M4 programming manual PM0214, SCB section, page 234:

    enter image description here