cancel
Showing results for 
Search instead for 
Did you mean: 

Missing definition of type "SPI_HandleTypeDef"

slai-nick
Associate II

I have configured a STM32 project in the ioc interface to use SPI2 - I can see it having the green check mark in the ioc interface. However when I generate code I don't see any spi driver header, and when compiling I get a:

error: unknown type name 'SPI_HandleTypeDef'; did you mean 'TIM_HandleTypeDef'?

 I am using the STM32CubeIDE version 1.16.0 on mac.

 

1 ACCEPTED SOLUTION

Accepted Solutions
slai-nick
Associate II

Thanks everyone for answering.

So a colleague ended up generating the code on his machine and pushing it in git so I inherited the files and didn't need to get them from the code generation anymore. However they were still not appearing in the project.

I found the "clean project" button, I did that and all the files appeared.

I suspect this was the solution since the beginning, however I can't reproduce what happened.

View solution in original post

4 REPLIES 4
STTwo-32
ST Employee

Hello @slai-nick and welcome to the ST Community :smiling_face_with_smiling_eyes:.

Can you share your .ioc file.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Guillaume K
ST Employee

Are you certain you generated your CubeMX project with SPI enabled ? normaly CubeMX should add in stm32X1xx_hal_conf.h file a #define HAL_SPI_MODULE_ENABLED. then when including stm32x1xx_hal.h it should include stm32x1_hal_spi.h and define SPI_HandleTypeDef.

Rim LANDOLSI
ST Employee

Hello @slai-nick , 

 

This problem is not reproduced on Mac OS. So make sure that your code generation is correct and that you are using MacOS® 13 (Ventura) or MacOS® 14 (Sonoma) as this may affect some features in STM32CubeIDE.

 

 

slai-nick
Associate II

Thanks everyone for answering.

So a colleague ended up generating the code on his machine and pushing it in git so I inherited the files and didn't need to get them from the code generation anymore. However they were still not appearing in the project.

I found the "clean project" button, I did that and all the files appeared.

I suspect this was the solution since the beginning, however I can't reproduce what happened.