...
The SPI communication will also need to be further configured. To configure it go to the .ioc file, find SPI1 in the Connectivity menu on the left:
...
The Hal library automatically generates the base code required to run the configuration you set when you save the .ioc file. You do want the IDE to generate code for you.
...
...
Configure the Timer (PWM)
To configure it go to the .ioc file, find TIM1 in the Timers menu on the left:
...
To start ensure that the channel (pin connected to timer) you chose is in the “PWM Generation CH#” mode. The clock source should be “Internal Clock” as we are using the clock that is built into the MCU.
The Prescaler and Period of the timer will need to be configured to meet the 50Hz. and 1ms to 2ms on-time required to drive the motor.
Coding in STM32 Cube IDE
Once you have generated your the code for the SPI and TIM (timer) configuration, you can find those values and setting will show up in the Core->Src directory in the project. Since you have configured those
To find the functions you will use to send and read messages from the ADC, find the stm32f0xx_hal_spi.h file in the Drivers->STM32F0xx_HAL_Driver->Inc directory and read the function prototypes at the bottom or visit the HAL User Manual and look for the SPI input and output functions (IO Operations).
...