cancel
Showing results for 
Search instead for 
Did you mean: 

Where to place user Code in IRQ handler generated by STM32 Cube

jezell
Associate
Posted on May 16, 2016 at 21:29

I am new to STM32 MCU's so I got the STM32F0 Discovery board to familiarize myself.  I am attempting to use STM32 Cube code generator.  

The STM32 Cube creates an IRQ handler for each interrupt I activate that look like this:

/**

* @brief This function handles TIM3 global interrupt.

*/

void TIM3_IRQHandler(void)

{

  /* USER CODE BEGIN TIM3_IRQn 0 */

  

  /* USER CODE END TIM3_IRQn 0 */

  HAL_TIM_IRQHandler(&htim3);

  /* USER CODE BEGIN TIM3_IRQn 1 */

  /* USER CODE END TIM3_IRQn 1 */

}

My question how do i decide whether to put code in the top or bottom part of the user code sections.  Thanks in advance for the help!

#interrupt #irq #smt32cube #m0
3 REPLIES 3
Amel NASRI
ST Employee
Posted on May 24, 2016 at 16:21

Hi jamieB,

All depends on your application. You may keep these user sections empty.

Please refer to some examples in the Cube package of the used product to know how this is implemented.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

bassetteporn11
Associate II
Posted on August 23, 2016 at 07:54

http://tinypic.com/view.php?pic=28whrx4&s=9#.V7voU_krKUk

I also am confused, can anybdy input some knowledge and kindly answer this image question jpeg I have attached.

Thanks.

________________

Attachments :

GENERAL_QUESTION.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtrV&d=%2Fa%2F0X0000000aY2%2Ff39p2U6IFoKYQ2_BL8gYSpvtv1jYYgaPvTUsl5XNiCk&asPdf=false
Posted on August 24, 2016 at 01:50

HAL adds a lot of abstraction. The processor calls the basic IRQ_Handlers described in the Vector Table, these in turn call an object handling form within HAL, ie it passes an internal structure down. IRQ_Handlers can't return values, the process destroys the context as it returns to normal execution.

C functions can return all manner of things, these can typically be up to 64-bit here, and can include structure pointers, enumerated values and typedef'd variables. Returning enumerated values rather than #defined ones allows the debugger can actually decode the types properly.

If you can cut-n-paste text don't use graphics.

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