Skip to Content
Block descriptionsSPICubeMX configuration for the given MCU model

CubeMX Configuration for a Given MCU Model

General CubeMX Settings

No.NamePathSettingDescriptionScreenshot
1SPI ModePinout & Configuration > Connectivity > SPI* > ModeFull-Duplex MasterSetting the SPI peripheral operating mode to Full-Duplex and the role to Master.SPI Mode setting
2SPI ClockClock ConfigurationValue depending on the target SPI bus speedSetting the clock source for the SPI interface. This value depends on the target SPI bus speed and the system clock configuration.SPI Clock setting
3Prescaler (for Baud Rate)Pinout & Configuration > Connectivity > SPI* > Parameter Settings > Basic Parameters > PrescalerValue depending on the target SPI bus speedSetting the prescaler for the SPI bus. This value depends on the target SPI bus speed and the system clock configuration.SPI Prescaler setting
4Data SizePinout & Configuration > Connectivity > SPI* > Parameter Settings > Basic Parameters > Data Size8 BitsSetting the size of data transmitted through the SPI interface.SPI Data Size setting
5Maximum output speedPinout & Configuration > Connectivity > SPI* > GPIO Settings > click the specific pin to open its configuration window > Maximum output speedVery HighSetting the maximum output speed for the GPIO pins responsible for the SCK, MISO, and MOSI lines of the SPI interface.SPI GPIO Pin Maximum Output Speed setting

CS (Chip Select) Pin Settings

The CS (Chip Select) pin can be configured in two ways: as a software-controlled GPIO pin or as a Hardware NSS Signal. The choice depends on the Chip Select parameter in the block configuration.

GPIO Pin as CS

No.NamePathSettingDescriptionScreenshot
1Hardware NSS SignalPinout & Configuration > Connectivity > SPI* > Mode > Hardware NSS SignalDisableDisabling the hardware NSS (CS) signal.SPI Hardware NSS setting
2GPIO Pin for CSPinout & Configuration > Pinout view > click the chosen GPIO pinGPIO_OutputConfiguring the GPIO pin as an output for the CS signal.SPI GPIO Pin setting
3Optional parameter
Pin User Label
Pinout & Configuration > Pinout view > right-click the chosen GPIO pinValue depending on the chosen pinSetting a custom user label for the GPIO pin used as CS.SPI GPIO Pin User Label setting
4GPIO Output LevelPinout & Configuration > System Core > GPIO > click the chosen GPIO pin and navigate to the settings below > GPIO output levelLowSetting the default logical output level of the GPIO pin used as CS.SPI GPIO Pin Output Level setting
5GPIO modePinout & Configuration > System Core > GPIO > click the chosen GPIO pin and navigate to the settings below > GPIO modeOutput Push PullSetting the operating mode of the GPIO pin used as CS.SPI GPIO Pin Mode setting
6GPIO Pull-up/Pull-downPinout & Configuration > System Core > GPIO > click the chosen GPIO pin and navigate to the settings below > GPIO Pull-up/Pull-downNo pull-up and no pull-downConfiguring internal pull-up or pull-down resistors for the GPIO pin used as CS.SPI GPIO Pin Pull-up/Pull-down setting
7Maximum output speedPinout & Configuration > System Core > GPIO > click the chosen GPIO pin and navigate to the settings below > Maximum output speedVery HighSetting the maximum output speed for the GPIO pin used as CS.SPI GPIO Pin Maximum Output Speed setting

Hardware NSS as CS

No.NamePathSettingDescriptionScreenshot
1Hardware NSS SignalPinout & Configuration > Connectivity > SPI* > Mode > Hardware NSS SignalHardware NSS Output SignalEnabling the hardware NSS (CS) output signal.SPI Hardware NSS setting
2Maximum output speedPinout & Configuration > Connectivity > SPI* > GPIO Settings > click the NSS pin to open its configuration window > Maximum output speedVery HighSetting the maximum output speed for the hardware NSS pin used as CS.SPI GPIO Pin Maximum Output Speed setting

Interrupts for the SPI interface are not required.

SPI* - the asterisk (*) symbol represents the number of the SPI module used in the model, e.g., SPI1, SPI2 etc.

Last updated on