cancel
Showing results for 
Search instead for 
Did you mean: 

Where can I download the library "stm32f3xx_spi.h" and "stm32f3xx_gpio.h" ?

FPalo.1
Associate II
 
3 REPLIES 3
Peter BENSCH
ST Employee

Either you mean the header files

  • stm32f30x_spi.h
  • stm32f30x_gpio.h

which are in the SPL (Standard Peripheral Library) for STM32F30x and STM32F334 (STSW-STM32108),

or you mean

  • stm32f3xx_hal_spi.h
  • stm32f3xx_hal_gpio.h

from the Cube firmware for the STM32F3 family.

Where is the source code to be found that wants these header files?

Regards

/Peter

In order 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.
FPalo.1
Associate II

I mean stm32f30x_spi.h and stm32f30x_gpio.h ,.

Here's a feature of my code to exemplify what I want

void SPI_Init(void)

{

 SPI_InitTypeDef SPI_InitStruct;

 GPIO_InitTypeDef GPIO_InitStruct;

 // Enable clock for SPI1 and GPIOA

 RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);

 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

 // Configure SPI1 pins: SCK, MISO, MOSI

 GPIO_InitStruct.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;

 GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;

 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;

 GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;

 GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;

 GPIO_Init(GPIOA, &GPIO_InitStruct);

 // Connect SPI1 pins to SPI alternate function

 GPIO_PinAFConfig(GPIOA, GPIO_PinSource5, GPIO_AF_5);

 GPIO_PinAFConfig(GPIOA, GPIO_PinSource6, GPIO_AF_5);

 GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_5);

 // Configure chip select pin for L3GD20

 GPIO_InitStruct.GPIO_Pin = L3GD20_CS_PIN;

 GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;

 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;

 GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;

 GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;

 GPIO_Init(L3GD20_CS_PORT, &GPIO_InitStruct);

 // Set chip select pin high to deselect L3GD20

 GPIO_SetBits(L3GD20_CS_PORT, L3GD20_CS_PIN);

 // Configure SPI1

 SPI_InitStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex;

 SPI_InitStruct.SPI_Mode = SPI_Mode_Master;

 SPI_InitStruct.SPI_DataSize = SPI_DataSize_8b;

 SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;

 SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;

 SPI_InitStruct.SPI_NSS = SPI_NSS_Soft;

 SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;

 SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;

 SPI_InitStruct.SPI_CRCPolynomial = 7;

 SPI_Init(SPI1, &SPI_InitStruct);

 // Enable SPI1

 SPI_Cmd(SPI1, ENABLE);

}

Peter BENSCH
ST Employee

OK, then you can take on the above-mentioned SPL STSW-STM32108.

If the problem is solved, please mark this thread as answered by selecting Select as best, as also explained here. This will help other users find that answer faster.

Good luck!

/Peter

In order 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.