cancel
Showing results for 
Search instead for 
Did you mean: 

STMCubeIDE won't include SPI HAL driver

RMod
Associate II

I am putting together a project for the U031 Nucleo board based on the DAC signal generation example project. From the configuration page I have added SPI, as well as TIM2 and the other required drivers (DAC, DMA, EXTI, TIM1). When it generates code, it looks like everything is there in way of configuration but stm32u0xx_hal_spi.c is not included in the drivers to be compiled. When I try to build the project the HAL_SPI_INT function cannot be found. It seems to find all the correct header files and the configuration in stm32u0xx_hal_config.h is correct and SPI is defined but it is not included in the make. It shows all the other required drivers in the driver directory but not spi.  The stm32u0xx_hal_spi.c and stm32u0xx_hal_spi_ex.c files are both in the same project folder with all the other drivers. I have checked the auto generated submake files and spi is not listed.

 If I build an example with just SPI then the driver is included. 

Originally I had the project compiling and working correctly without SPI but when I tried to add SPI no luck. I have tried building a new project with all the needed drivers but I see the same result, no SPI.

It looks like the project does not get correct configured by the IDE configuration tool. The project settings need to be edited but I can't find the right place to modify.

Any suggestions on how to get the SPI driver to be included in the build would be much appreciated. 

16 REPLIES 16

That is weird because when I add SPI and generate code, I do get the stm32u0xx_hal_spi.c/h files added. 

The only issue I saw was the compiler didn't uncomment the code in the stm32u0xx_hal_spi.c, in between the define HAL_SPI_MODULE_ENABLED

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

It IS really weird. Since Mahmoud reproduced the problem and now it is in the hands of the ST development team I am kind of stuck. Since your project works, maybe you could send your project for me to work from?

Here is a screenshot to show that the SPI driver was added and that HAL_SPI_Init is not commented out after the temporary HAL_SPI_MODULE_ENABLED fix. I can also build with no errors. I've attached the project.

KarlYamashita_1-1734725435297.png

 

 

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Thanks a bunch Karl. This really helps me. 

I will give this a try and let you know what happens.

RMod
Associate II

Well it was a nice try but I am running into issues with my lack of code development experience. I am primarily a hardware designer and do very limited amount of code development. When I imported the project, I found that it is missing the project settings and configurations. 

Without the settings I cannot build the project.  Reconfiguring you project to work in my environment is something I am not clear on how to do. 

Any suggestions would be welcome. 

All the files were zipped. You say project settings and configurations are missing, but how exactly does STM32CubeIDE indicate the error? Screen shot?

Are you on Windows?

Maybe STM32CubeIDE version 1.17.0 has some issues? Try uninstalling it and then install version 1.16.1 

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

I am on Windows. I will try reimporting the project. I may have missed something that caused the setting to not be imported. 

As another more extreme workaround, I tried configuring a NUCLEO-U083 board for DACSignalGeneration with SPI and TIM2. This worked. The devices are similar enough were I can continue working until the ST team fixes the configuration tool.