The CMSIS-Driver SPI requires:
- Setup of SPIx input clock
- Setup of SPIx in Full-Duplex Master/Slave mode
Valid settings for various evaluation boards are listed in the table below:
Peripheral Resource | B-U585I-IOT02A (PMOD CN4) |
SPI Peripheral | SPI 1 |
SPI Mode | Full-Duplex Master |
NSS Pin | PA4 |
SCK Pin | PE13 |
MISO Pin | PE14 |
MOSI Pin | PE15 |
For different boards, refer to the hardware schematics to reflect correct setup values.
The STM32CubeMX configuration for B-U585I-IOT02A with steps for Pinout, Clock, and System Configuration are listed below. Enter the values that are marked bold.
Pinout view
- Configure SPI1 pins
- PA4: SPI1_NSS
- PE13: SPI1_SCK
- PE14: SPI1_MISO
- PE15: SPI1_MOSI
Pinout & Configuration tab
- Under Connectivity open SPI1:
- Section Mode
- Mode: Full-Duplex Master
- Hardware NSS Signal: Hardware NSS Output Signal
- Hardware RDY Signal: Disable
- Section Configuration
- Parameter Settings: not used
- User Constants: not used
- NVIC Settings: configured later
- DMA Settings: configured with GPDMA1
- GPIO Settings: check used pins
- Under System Core open GPIO:
- Group By Peripherals - SPI:
Pin Name | Signal on Pin | GPIO mode | GPIO Pull-up/Pull.. | Maximum out.. |
PA4 | SPI1_NSS | Alternate F.. | No pull-up and no.. | Very High |
PE13 | SPI1_SCK | Alternate F.. | No pull-up and no.. | Very High |
PE14 | SPI1_MISO | Alternate F.. | No pull-up and no.. | Very High |
PE15 | SPI1_MOSI | Alternate F.. | No pull-up and no.. | Very High |
- Under System Core open GPDMA1:
- Section Mode
- Channel 0: Standard Request Mode
- Channel 1: Standard Request Mode
- Section Configuration
- CH0
- Request Configuration - Request: SPI_TX
- Channel configuration - Direction: Memory to Peripheral
- Source Data Setting - Source Address Inc..: Enabled
- Source Data Setting - Data Width: Byte
- Destination Data Setting - Destination Address Inc..: Disabled
- Destination Data Setting - Data Width: Byte
- CH1
- Request Configuration - Request: SPI_RX
- Channel configuration - Direction: Peripheral to Memory
- Source Data Setting - Source Address Inc..: Disabled
- Source Data Setting - Data Width: Byte
- Destination Data Setting - Destination Address Inc..: Enabled
- Destination Data Setting - Data Width: Byte
- Under System Core open NVIC:
- Section Configuration
- NVIC
NVIC Interrupt Table | Enable | Preemption Priority | Sub Priority |
GPDMA1 Channel 0 global interrupt | ON | 0 | 0 |
GPDMA1 Channel 1 global interrupt | ON | 0 | 0 |
SPI1 global interrupt | ON | 0 | 0 |
Clock Configuration tab
- Configure SPI1 Clock.
Project Manager tab
- Open Advanced Settings:
- enable Do Not Generate Function Call for MX_SPI1_Init.