HAL library 08- SPI for STM32Fxxx

Next library in ported libs is SPI for HAL based drivers for STM32F4xx and STM32F7xx based devices.

Library

Read more about new HAL libraries

Features

  • Operate with up to 6 SPI peripherals
  • Send single or multiple bytes at time
  • Automatic SPI prescaler selection based on maximum clock selected for your external device
  • Software based Chip Select pin
  • Support for custom GPIO pins combination for SPI

Dependencies

  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h
    • GPIO

Pinouts

Table with SPI pins for different pinspack. Pinspack is selected on library initialization.

Pins pack 1 Pins pack 2 Pins pack 3 Pins pack 4
SPIx MOSI MISO SCK MOSI MISO SCK MOSI MISO SCK MOSI MISO SCK
SPI1 PA7 PA6 PA5 PB5 PB4 PB3
SPI2 PC3 PC2 PB10 PB15 PB14 PB13 PI3 PI2 PI0 PB15 PB14 PI1
SPI3 PB5 PB4 PB3 PC12 PC11 PC10
SPI4 PE6 PE5 PE2 PE14 PE13 PE12
SPI5 PF9 PF8 PF7 PF11 PH7 PH6
SPI6 PG14 PG12 PG13

Functions and enumerations

Example

Project is available on Github, download all libraries below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!