2022-04-10 09:41 AM
Hi, I'm trying to use IRQ Software calls with Nucleo-F4 boards in STMCubeMx 1.8 environment.
The UM1725 - Rev 7, pag. 346, tells me to use the HAL_Generate_SWI.
The call, included in stm32f4xx_hal_exti, requires you to define two simple structures: EXTI_HandleTypeDef and EXTI_ConfigTypeDef and the test program seems to work.
I have noticed that when I generate the configuration code with MX, the NVIC libraries are still used for interrupts , present in stm32f4xx_hal_cortex. In the Cortex Library there in no SW IRQ generation call.
The questions are these:
for external interrupts, when to use the library in stm32f4xx_hal_exti and when to use those in stm32f4xx_hal_cortex?
Anyone have an example of SWI interrupt handling for F4 models? (nothing in the web)
Many Thanks.
LV
2022-04-12 01:31 PM
To clarify the matter, I wrote a simple project for STM32F401RE. The pin, twice involved, is the one reserved for the BLUE key (PC13). If it is pressed (I do not take into account problems related to bouncing here) it generates a HW interrupt and requests a status inversion to the green LED. However, every 3000 msec a SW call is generated which does the same thing (I could have done another thing but I only have one led on the board ...). If you have a Cube development environment (I used 1.8) you can download it from this link, import it and try it. How did I check if it was a SW or HW interrupt? stupidly, checking the status of the button, after the call .... It is certainly a source of errors, but this is not the question, I would say a little more complex and general. LV
2022-04-12 02:30 PM
> I don't quite understand your A / B concerns
Sorry I meant X/Y problem :) Perhaps triggering EXTI line interrupts does not help to achieve your actual goal/need.
What is the "SW call"? how do you measure 3000 ms - with a timer?
if you want to toggle the LED just toggle it, you don't have to simulate a button press.
2022-04-12 10:09 PM
Yes, I smulate a pression af the botton press with the STM HAL call HAL_Generate_SWI(13).
LV
2022-04-13 05:04 PM
What is HAL_Generate_SWI? STM32F4 is Cortex-M4. Maybe you mean HAL_EXTI_GenerateSWI ? or SVC?
Here is an article explaining use of SVC, it allows to pass parameters to the "service" interrupt handlers.
2022-04-13 10:57 PM
for HAL_Generate_SWI, as I say, read at STM UM1725 - Rev 7, pag. 346
2022-04-13 11:58 PM
Yes , a memory (my) error. HAL_EXTI_GenerateSWI as decripted at page 349, UM1725 Rev 7. Now I see the site.Many thanks