Skip to main content
MQi.1
Senior II
July 6, 2021
Question

error: unknown type name 'TIM_HandleTypeDef';

  • July 6, 2021
  • 6 replies
  • 3575 views

I met these error:

stm32g4xx_hal_timebase_tim_template.c:56:1: error: unknown type name 'TIM_HandleTypeDef'; did you mean 'EXTI_HandleTypeDef'?

how to fix it?

This topic has been closed for replies.

6 replies

TDK
July 6, 2021

Template files are there for you to edit and customize for your application.

But generally this error is because you haven't included the top-level header file.

#include "stm32g4xx.h"

Or your HAL configuration file doesn't include the timer peripheral. Ensure the following line exists and is not commented out of stm32g4xx_hal_conf.h.

#define HAL_TIM_MODULE_ENABLED

"If you feel a post has answered your question, please click ""Accept as Solution""."
MQi.1
MQi.1Author
Senior II
July 7, 2021

In this file:"stm32g4xx_hal_conf_template.h"(system-->include-->stm32g474xx-->)

I found this words:"This file should be copied to the application folder and renamed to stm32g4xx_hal_conf.h."

Tesla DeLorean
Guru
July 7, 2021

Yes, so do that, and modify the line to enable the TIM module to be pulled.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
July 7, 2021

If you're new or don't know how to set up HAL manually, use CubeMX to generate the starting point for your project.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MQi.1
MQi.1Author
Senior II
July 9, 2021

Could the starting point for your project generated by CubeMX be used in eclipse?

TDK
July 9, 2021

CubeMX code can be used by Eclipse.

"If you feel a post has answered your question, please click ""Accept as Solution""."