STM32Cube  Version 2.0
Create Projects for STM32F3 Series with STM32Cube HAL and STM32CubeMX
 All Files Pages
Setup CMSIS Driver

CMSIS-Driver provide generic peripheral interfaces for middleware and application code. The CMSIS-Driver cooperates with the STM32Cube HAL.

In MDK you should select the CMSIS-Driver in the Manage Run-Time Environment window.

select_cmsis_driver.png

You should configure the parameters for these CMSIS-Driver in STM32CubeMX as described below. Once you use Generate Code in STM32CubeMX, the relevant STM32Cube HAL components are added to the MDK project. Refer to Setup STM32Cube Framework - STM32CubeMX for more information about the overall process.

Configuration with STM32CubeMX

For each CMSIS-Driver the setup with STM32CubeMX is explained in the pages below.

MX_Device.h Configuration File

STM32CubeMX generates for the configuration of the CMSIS-Driver the file MX_Device.h. The file MX_Device.h contains sections for every peripheral that is enabled in the STM32CubeMX configuration. The #define symbols have the same names as in the classic configuration file RTE_Device.h and are used by the CMSIS-Driver when the component Device:STM32Cube Framework (API):STM32CubeMX is selected in the RTE.

Example:

/*-------------------------------- I2C1 --------------------------------*/
#define MX_I2C1 1
/* GPIO Configuration */
/* Pin PB8 */
#define MX_I2C1_SCL_GPIO_Speed GPIO_SPEED_HIGH
#define MX_I2C1_SCL_Pin PB8
#define MX_I2C1_SCL_GPIOx GPIOB
#define MX_I2C1_SCL_GPIO_PuPdOD GPIO_PULLUP
#define MX_I2C1_SCL_GPIO_Pin GPIO_PIN_8
#define MX_I2C1_SCL_GPIO_AF GPIO_AF4_I2C1
#define MX_I2C1_SCL_GPIO_Mode GPIO_MODE_AF_OD
/* Pin PB9 */
#define MX_I2C1_SDA_GPIO_Speed GPIO_SPEED_HIGH
#define MX_I2C1_SDA_Pin PB9
#define MX_I2C1_SDA_GPIOx GPIOB
#define MX_I2C1_SDA_GPIO_PuPdOD GPIO_PULLUP
#define MX_I2C1_SDA_GPIO_Pin GPIO_PIN_9
#define MX_I2C1_SDA_GPIO_AF GPIO_AF4_I2C1
#define MX_I2C1_SDA_GPIO_Mode GPIO_MODE_AF_OD