Skip to main content
Associate II
July 9, 2024
Solved

Missing definition of type "SPI_HandleTypeDef"

  • July 9, 2024
  • 4 replies
  • 2936 views

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.

 

Best answer by slai-nick

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.

4 replies

STTwo-32
ST Technical Moderator
July 9, 2024

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

Can you share your .ioc file.

Best Regards.

STTwo-32

Guillaume K
ST Employee
July 9, 2024

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
July 9, 2024

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-nickAuthorBest answer
Associate II
July 10, 2024

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.