AnsweredAssumed Answered

Help with HAL timers

Question asked by meini.marco on May 12, 2015
Latest reply on May 12, 2015 by meini.marco
Hi, I'm fairly new to STM32 and, since I have to learn it from zero, I'm dealing with HAL which I'm told it's the future.
Well, maybe it will, but by now I'm having a hard time dealing with it. Docs are ok, but I can find almost no example except for the very basic GPIO/blinky.
I'm now trying to experiment a little bit with timers but my compiler (Eclipse-gnu gcc) is not able to find a few macro.
This is my init code:
01.TIM_HandleTypeDef TIM_Handle;
02.__TIM3_CLK_ENABLE();        // timer
03.TIM_Handle.Init.Prescaler = 671 ;
04.TIM_Handle.Init.CounterMode = TIM_COUNTERMODE_UP;
05.TIM_Handle.Init.Period = 62499;
06.TIM_Handle.Instance = TIM3;   // Enable TIMER 3. Same timer whose clocks we enabled
07.HAL_TIM_Base_Init(&TIM_Handle);     // Init timer
08.HAL_TIM_Base_Start_IT(&TIM_Handle); // start timer interrupts
09.// we also need to setup interrupt to handle timer 3 request:
10.HAL_NVIC_SetPriority(TIM3_IRQn, 0, 1);        // 0 is the highest priority

And this is the handler:

02.void TIM3_IRQHandler(void)
04.    if (__HAL_TIM_GET_FLAG(&T3_Handle, TIM_FLAG_UPDATE) != RESET)      //In case other interrupts are also running
05.    {
06.        if (__HAL_TIM_GET_ITSTATUS(&T3_Handle, TIM_IT_UPDATE) != RESET)
07.        {
08.            __HAL_TIM_CLEAR_FLAG(&T3_Handle, TIM_FLAG_UPDATE);
10.           // some led blinking code here...
11.        }
12.    }

And I'm getting these errors/warnings:

- Symbol 'T3_Handle' could not be resolved
- implicit declaration of function '__HAL_TIM_GET_ITSTATUS'

I'm icluding these:
1.#include "stm32f4xx.h"
2.#include "stm32f4xx_hal.h"

I've also removed the check from "exclude resource from build" on stm32f4xx_hal_tim.c

On my stm32f4xx_hal_conf.h I have #define HAL_TIM_MODULE_ENABLED uncommented...

I can find the needed definition inside stm32f4xx_hal_tim.c so why am I unable to compile it?

Oh... if you have some link of HAL examples/tutorials please share.

Thank you very much for your help.