cancel
Showing results for 
Search instead for 
Did you mean: 

Software Interrupt NVIC

Michael Kühebacher
Associate II
Posted on February 27, 2017 at 19:51

I can not find enough information about the definition of a software interrupt with NVIC.

If the edge of an internal software bit is positive, an interrupt routine should be executed

Thanks

#stm32f4
8 REPLIES 8
Posted on February 27, 2017 at 20:50

The NVIC is ARM's part of the design, you'd likely want to review the TRM, and books by Joseph Yiu, for specifics

Let's play it from this angle, what have you tried (show code), and how does that deviate from expectations.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Michael Kühebacher
Associate II
Posted on March 01, 2017 at 20:21

Sorry; tried a lot but without success. I can not find an example in which an internal programmbit 'Pippo' triggers an interrupt

Tuttle.Darrell
Associate II
Posted on March 01, 2017 at 20:49

You haven't mentioned what processor you are using. If you are looking to set up an interrupt that may be triggered by software, consult your reference manual and do a search for 'software interrupt'. In the STM32F407, the EXTI controller has a register called 'Software interrupt event register'. From the reference manual: 'An interrupt/event request can also be generated by software by writing a ‘1’ in the software interrupt/event register.'

Posted on March 05, 2017 at 10:28

With setting:  EXTI_IMR |=0x10; and  EXTI_EMR |=0x10;

when i write: EXTI_SWIER |=0x10; then  EXTI_PR changes from 0x00  to 0x10 (Ok)

Question: which interrupt subroutine is executed EXTI_IRQ4_ISR() ?

S.Ma
Principal
Posted on March 05, 2017 at 12:26

0690X00000606OJQAY.png

The SW interrupt replaces the Input pin. 

Available interrupt vectors are:

DCD EXTI0_IRQHandler ; EXTI Line0

DCD EXTI1_IRQHandler ; EXTI Line1

DCD EXTI2_IRQHandler ; EXTI Line2

DCD EXTI3_IRQHandler ; EXTI Line3

DCD EXTI4_IRQHandler ; EXTI Line4

DCD     EXTI9_5_IRQHandler                ; External Line[9:5]s

DCD     EXTI15_10_IRQHandler              ; External Line[15:10]

(startup_stm32xxx.s file)

Usually the interrupt handlers are in stm32xx_it.c

Posted on March 05, 2017 at 20:55

Sorry, I can not find in the handbooks of STM32F407VG how to assign an interrupt (EXTI_SWIER.B4 = 1) to a routine and which name the Rotione has!

'STM42F4xx_Reference_manual_DM00031020' -

'Programming_Manual__en.DM00046982'

Posted on March 05, 2017 at 22:08

P388 from RM

Take an example in cube of EXTI external interrupt with GPIO. Put a breakpoint in the interrupt routine.

Trigger the interrupt and confirm code stops. Now, open the EXTI HW register window in the debugger and manually disable rise and fall detection on that EXTI. continue the code until it goes back to main loop. Stop the code and set the corresponding SW interrupt bit. Continue the code and check if the interrupt breakpoint is activated. If successful, then the rest should be pure coding...