Skip to main content
MQi.1
Senior II
Jul 6, 2021 3:31 AM UTC
Question

error: unknown type name 'TIM_HandleTypeDef';

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
Jul 6, 2021 3:51 AM UTC

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
Jul 7, 2021 1:12 AM UTC

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
Jul 7, 2021 1:17 AM UTC

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
Jul 7, 2021 3:56 AM UTC

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
Jul 9, 2021 8:54 AM UTC

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

TDK
Jul 9, 2021 2:11 PM UTC

CubeMX code can be used by Eclipse.

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