8 years, 10 months ago.

TIM4_IRQHandler() Nucleo F103RB

Hi,

I've already developped a properly working TIM4_IRQHadnler() on my Nucleo via Eclipse. I try now to use it in mbed, but it does not work. In fact, the TIM4_IRQHandler() function never starts)

I think it is a problem with the startup file and the TIM4_IRQHandler() name. (BTW, I've never find startup file, and I am not include mbed .h in my program since the other functionnalities work properly including "StdPeriphExamples" files)

Has anyone ever faced this problem ? Do you know how to solve it ? Here is its code:

TIM4_IRQHandler()

#ifdef __cplusplus
extern "C" {
#endif

void TIM4_IRQHandler(void)
{
    //Measuring RPM frequency
    if (TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET)
        {
            static uint16_t ICValue1 = 0, ICValue2 = 0;

            TIM_ClearITPendingBit(TIM4, TIM_IT_CC3);

            if (pulse == 0)
            {
                ICValue1 = TIM_GetCapture3(TIM4);
                pulse = 1;
            }
            else
            {
                ICValue2 = TIM_GetCapture3(TIM4);
                TIM4CH3Measurement = ICValue2 - ICValue1;
                ICValue1 = ICValue2;
            }
        }
}

#ifdef __cplusplus
}
#endif

Best regards,

Julien.

1 Answer

Julien Kern
poster
8 years, 10 months ago.

Hello,

I've finally managed to make it work ! I've found the "InterruptManager.h" file, and saw a method with a very beautiful name:

pFunctionPointer_t add_handler_front(void (*function)(void), IRQn_Type irq)

Then I used it in my program like this:

InterruptManager::get()->add_handler(TIM4_IRQHandler, TIM4_IRQn);

And then the interrupt is starting properly. Hope this will help !

Regards,

Julien.

Accepted Answer

Hello Julien Thank for your post. I am preparing some labs for students so your experience is very useful. Please can you give your working code? or the simple one Thanks in advance

posted by darga arouna 02 Aug 2015

Assigned to Julien Kern 8 years, 10 months ago.

This means that the question has been accepted and is being worked on.