cancel
Showing results for 
Search instead for 
Did you mean: 

Set software interrupt with its own priority?

STM32Freakz
Associate II

MCU STM32F765GZ

My Problem:

EXTI_LINE_0-4 has separate IRQ handlers but al are occupied.

EXTI_LINE_5-9 share the same IRQhandler and also priority. pin 6 is needed with prio 1(brownout mon)

EXTI_LINE_10-15 share the same IRQhandler and also priority. pin 12 is needed with prio 2(paperclip btn)

I need an interrupt on pin 5 with a low prio(10)

Solution: keep EXTI_LINE_5-9 with prio 1. Let handler find out if the interrupt was for pin 5, and if so trigger a low prio software interrupt which in turn wil execute my low prio code.

Question: I find the documentation here to be confusing. How can I set up an software interrupt with its own priority to handle this? I dont want to change priority of something else here. Is it possible for the sw interrupt to have its own handler? how?

thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Take any interrupt vector not used in your application.

Set desired priority on it with HAL_NVIC_SetPriority().

Then call NVIC_SetPendingIRQ to trigger.

View solution in original post

4 REPLIES 4
Pavel A.
Evangelist III

Take any interrupt vector not used in your application.

Set desired priority on it with HAL_NVIC_SetPriority().

Then call NVIC_SetPendingIRQ to trigger.

STM32Freakz
Associate II

You mean that I can steal anyone of the IRQn_Type:s and call those functions with it?..its a big application, but I´ll guess I have to see if theres any one free.

Just to make sure: Its not possible to add a custom interrupt handler here right?

TDK
Guru

Since EXTI5-9 have a shared interrupt, you can't separate them into their own interrupts. They are hardwired to share the same one and therefore will have the same priority for all pins.

Is that what you're asking?

You can't just create a new interrupt that does what you want, you have to use the ones that are available.

Edit: I think Pavel A understood you better here.

If you feel a post has answered your question, please click "Accept as Solution".

"Since EXTI5-9 have a shared interrupt, you can't separate them into their own interrupts. They are hardwired to share the same one and therefore will have the same priority for all pins."

Yes I am aware. I trying to work around this by triggering a software interrupt in the EXTI9_5_IRQHandler(). But I was confused as to how to go about it. By Ive tried now to use CAN2_RX0_IRQn for this purpose and it seems to work. not pretty but at least it works