cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling peripherals for SPI communication in seongji LSM110A project

DesignOmicron
Associate

Hello.
I am working on the LSM110A communications module project https://github.com/Support-SJI/LSM110A and I want to enable the necessary peripherals to be able to communicate the module with a MEMS using the SPI standard.
The first thing I developed was the creation of a project, in STM32CubeIDE, in which I configured the SPI communication to the STM32WLE5CCU6 module. I created the code and used the source files (.c), which are included there, within the LSM110A project.
Inside the “Drivers/STM32WLxx_HAL_Driver” folder of the LSM110A project, I created a file with the “link to file in file system” configuration and linked the source file “stm32wlxx_hal_spi.c”. Likewise, I performed the above procedure but with the “spi.c” file that is hosted in the “Application/User/Core” location; I also made sure that, in the folder containing the header files (.h), the “stm32wlxx_hal_spi.h” and “spi.h” files were included.
My problem is that, when I made the linking of the “spi.c” file to the LSM110A project, I get the following errors:

DesignOmicron_1-1730820579682.png

DesignOmicron_2-1730820640460.png

DesignOmicron_0-1730820429190.png

 

I have checked with the project I created to enable the peripherals for SPI communication and it does not show any error. The only thing I have been able to detail is that, when I include the header file “stm32wlxx_hal_spi.h” in the “spi.c” file, most of the errors disappear, but the following ones appear:

DesignOmicron_4-1730821029989.png

DesignOmicron_3-1730820933334.png

 

Explicitly, it is this error that I cannot understand: conflicting types for "conflicting types for 'hspi1'; have 'SPI_HandleTypeDef' {aka 'struct __SPI_HandleTypeDef'}".

Thank you very much in advance for your attention and your cooperation to help me to solve this problem.

5 REPLIES 5
Andrew Neil
Evangelist III

It's better to copy & paste the build output from the 'Console' window as text - your screenshot image has cut off important information...

 

Pavel A.
Evangelist III

The first error about SPI_HandleTypeDef is "unknown type name 'SPI_HandleTypeDef' " - somehow stm32wlxx_hal_spi.h file content is not included in your compilation. Resolve this first.

 


@Pavel A. wrote:

Resolve this first.


Indeed.

@DesignOmicron it's important to resolve the earliest-reported error first - as that is likely the source of many subsequent errors.

The 'Problems' view is particularly unhelpful here, as it does not present the errors in order.

Hence the 'Console' is the more useful view.

You can do a Select-all in the 'Console' window, copy, and then paste here as text - not a screenshot.

 

DesignOmicron
Associate

Thank you very much for your interest and collaboration. I managed to solve my problem and it was very simple. I only needed to enable the definition that enables the SPI module in the stm32wlxx_hal_conf.h header file.


@DesignOmicron wrote:

I managed to solve my problem and it was very simple..


Indeed - as already noted, it is often the case that one simple fix will also fix loads of other resulting errors.

Please mark the solution:

https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256