Skip to main content
Ken Inoue
Associate III
August 3, 2017
Solved

How to use HAL_HRTIM_IRQHandler

  • August 3, 2017
  • 1 reply
  • 2338 views
Posted on August 03, 2017 at 20:31

Thank you for your patronage. 

I'm Japanese. 

I want to use

Interrupt Service Routine(ISR)

 as shown in the picture below. So I want to use HAL_HRTIM_IRQHandler.0690X00000607rqQAA.png

I wrote the program as shown below, but I got an error. 

0690X00000607s5QAA.png0690X00000607rkQAA.png
    This topic has been closed for replies.
    Best answer by Elkin Granados
    Posted on August 03, 2017 at 22:33

    Hi inoue.ken,

    Maybe if you could provide to the forum more information we could help you better!

    For the warning I suppose that you are using the HAL libraries with the CubeMX, when you work with those libraries the function for the IRQ handler is created by default, so you don't have to declare it again. The functions which you have to modify are the callbacks. The default function for the IRQ handler is the following:

    0690X00000607giQAA.png

    As you can see, the function takes the program to another function depending on the source of the interruption. I'm not completely sure if the interruptions in your case are the HRTIM_HRTIM_ISR, HRTIM_Master_ISR or HRTIM_Timer_ISR, but in the file stm32f3xx_hal_hrtim.c you can check all the callbacks and declare the proper functions:

    0690X00000607sOQAQ.png0690X00000607mgQAA.png

    For example, in the compare 1 and compare 3 you have to read a value, so you must declare the callback of those functions, by default the callbacks are declare as weak in the file:

    0690X00000607sTQAQ.png

    So you have to declare the function without the weak in other file of your code as in the main, and in the callback do the things that you have to do in the interruption:

    0690X00000607siQAA.png 

    And do the same for the period callback that is where you have to update the values (I'm not sure if is HAL_HRTIM_BurstModePeriodCallback(hhrtim);  or HAL_HRTIM_RepetitionEventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); or  HAL_HRTIM_RegistersUpdateCallback(hhrtim, HRTIM_TIMERINDEX_MASTER);, or HAL_HRTIM_RepetitionEventCallback(hhrtim, TimerIdx);  or HAL_HRTIM_RegistersUpdateCallback(hhrtim, TimerIdx); you should try those, sorry for can't give to you the exactly information ) but for example if is 

    HAL_HRTIM_BurstModePeriodCallback(hhrtim); the declaration will be:

    0690X00000607ssQAA.png

    Hope that be helpful for you! (by the way I'm Colombian not Columbian  !nice to meet you)

    1 reply

    Elkin Granados
    Elkin GranadosBest answer
    Associate II
    August 3, 2017
    Posted on August 03, 2017 at 22:33

    Hi inoue.ken,

    Maybe if you could provide to the forum more information we could help you better!

    For the warning I suppose that you are using the HAL libraries with the CubeMX, when you work with those libraries the function for the IRQ handler is created by default, so you don't have to declare it again. The functions which you have to modify are the callbacks. The default function for the IRQ handler is the following:

    0690X00000607giQAA.png

    As you can see, the function takes the program to another function depending on the source of the interruption. I'm not completely sure if the interruptions in your case are the HRTIM_HRTIM_ISR, HRTIM_Master_ISR or HRTIM_Timer_ISR, but in the file stm32f3xx_hal_hrtim.c you can check all the callbacks and declare the proper functions:

    0690X00000607sOQAQ.png0690X00000607mgQAA.png

    For example, in the compare 1 and compare 3 you have to read a value, so you must declare the callback of those functions, by default the callbacks are declare as weak in the file:

    0690X00000607sTQAQ.png

    So you have to declare the function without the weak in other file of your code as in the main, and in the callback do the things that you have to do in the interruption:

    0690X00000607siQAA.png 

    And do the same for the period callback that is where you have to update the values (I'm not sure if is HAL_HRTIM_BurstModePeriodCallback(hhrtim);  or HAL_HRTIM_RepetitionEventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); or  HAL_HRTIM_RegistersUpdateCallback(hhrtim, HRTIM_TIMERINDEX_MASTER);, or HAL_HRTIM_RepetitionEventCallback(hhrtim, TimerIdx);  or HAL_HRTIM_RegistersUpdateCallback(hhrtim, TimerIdx); you should try those, sorry for can't give to you the exactly information ) but for example if is 

    HAL_HRTIM_BurstModePeriodCallback(hhrtim); the declaration will be:

    0690X00000607ssQAA.png

    Hope that be helpful for you! (by the way I'm Colombian not Columbian  !nice to meet you)

    Ken Inoue
    Ken InoueAuthor
    Associate III
    August 6, 2017
    Posted on August 06, 2017 at 21:37

    Thanks a million! I'm really sorry for late reply. I understand I

     don't have to declare IRQ Handler again.

    The information you gave me a lot of help. Because I do not have anyone using ST microcomputers around, it is very helpful. I will do my best at university research. Thank you very much.