AnsweredAssumed Answered

STM32Cube and include files

Question asked by Thomas Carrington on Sep 2, 2017
Latest reply on Apr 27, 2018 by Mike Veltman

Hi Everyone,

 

I've been using a Nucleo F103RB for a while now, adding onto the default code provided via Atollic's TrueStudio setup. With this, I have been able to initialise and communicate successfully with I2C, SPI and UART.

I now want to see if I can build the project up from scratch using the STM32Cube plug-in (which looks great in terms of getting I/O and interfaces going).

I've had success in getting a LED to flash, so now I want to get the SPI working again.

What I'm trying to do is create a pointer to the SPI interface that I have generated via the cube, this pointer will then be used by my SPI code to communicate. I've put the declaration of this pointer within my code, and when compiling I get the following error:

unknown type name 'SPI_HandleTypeDef'' 

unknown type name 'GPIO_TypeDef'.

 

 

I managed to fix the GPIO error by adding "stm32f1xx.h" as included within the code. But this isn't fixing the 'SPI_Handle', which I don't understand as the header which defines this "stm32f1xx_hal_spi.h" is references (eventually) by "stm32f1xx.h".

And if I just straight include "stm32f1xx_hal_spi", it then starts complaining about unknown type name 'DMA_HandleTypeDef' within "hal_spi", then about 30+ errors on using the DMA within "hal_spi"!!

 

I have a strong feeling that I am missing something, like setting up the project/including something, but for the life of me, I cannot find it. I've configured the project so that it includes the "Build_Files" which includes the code I'm talking about "Device.h".

 

I've attached a copy of my "Device.h" code, along with how I've structured the folders for this project.

If anyone can help with fixing this problem I would be grateful.

 

Cheers - Thomas

Attachments

Outcomes