cancel
Showing results for 
Search instead for 
Did you mean: 

Cube - How can I disable IRQ function call generation in STM32xxx_it.c function?

EGi
Associate III

On a L412KB core HAL is quite unstable if the core receives ~250K interrupts per second. Without HAL I could get everything stable, but for read-ability I would like to put the interrupt service routine in another file as STM32xxx_it.c Besides that, I have some pragma statement added to the IRQ service routine. This is deleted every code generation.

Cube always seem to generate the IRQ function in STM32xxx_it.c when interrupt is enabled, So I have a conflict the interrupt service routine is defined in my own file + STM32xxx_it.c file. The only solutions I found so far:

  • Enable peripheral IRQ in my own routine, because cube assumes it's off. But this makes it also less maintain-able, because if something is nice about Cube it's the ability to have an overview of all interrupts and levels in NVIC.
  • Callback function disable has no effect: the interrupt service is always generated..
  • After each code generation, I have to restore __WEAK for the generated irq service functions.

I tried to encapsulate the pragma / __WEAK directives with /* USER CODE BEGIN */ and end before the function in STM32xxx_it.c file, but Cube deletes those each code generation.

A solution would be that each auto generated function has such a /* USER CODE BEGIN */ /* USER CODE END */ just before the function itself, so one can add pragma / __WEAK / other directions if needed.

Does cube have the ability to declare such functions as __WEAK (in that case it's a well hidden feature)?

Present Cube Version: 1.11.2 Build: 14494_20230119_0724 FW Package = STM32CubeFW_L4_V1.17.2)

2 REPLIES 2

You're only going to get excessive interrupts if you don't service them properly, at the source.

You can disable interrupts in the NVIC

Stop regenerating the primary code, IF you must constantly regenerate do it to a sand-box project and then merge over the things you need.

You can create your own interrupt function names in startup.s if you need different ones.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
EGi
Associate III

FYI: the interrupts are correctly served. I have to deal with this massive amount of input capture. Timing must be checked (small calculation) on the fly, No errors are flagged (all measurements valid). But if this is combined with UART HAL DMA, these DMA interrupt stop at a certain moment and the UART buffer overruns (the DMA interrupt flag is not set when break at UART overflow detection).

I will change the interrupt service name in the startup file (that should indeed not be regenerated).