diff --git a/cube/Core/Inc/main.h b/cube/Core/Inc/main.h index f5c24e3..29260ef 100644 --- a/cube/Core/Inc/main.h +++ b/cube/Core/Inc/main.h @@ -61,6 +61,8 @@ void Error_Handler(void); #define debugUart huart4 #define mbusUart huart5 #define frontendAdc hadc1 +#define eepromSpi hspi2 +#define etherSpi hspi1 #define Loop_Enable_Pin GPIO_PIN_2 #define Loop_Enable_GPIO_Port GPIOE #define Loop_Disable_Pin GPIO_PIN_3 @@ -74,10 +76,26 @@ void Error_Handler(void); #define LED_Red_GPIO_Port GPIOE #define Frontend_In_Pin GPIO_PIN_1 #define Frontend_In_GPIO_Port GPIOA +#define ETHER_CS_Pin GPIO_PIN_4 +#define ETHER_CS_GPIO_Port GPIOA +#define ETHER_SCLK_Pin GPIO_PIN_5 +#define ETHER_SCLK_GPIO_Port GPIOA +#define ETHER_MISO_Pin GPIO_PIN_6 +#define ETHER_MISO_GPIO_Port GPIOA +#define ETHER_MOSI_Pin GPIO_PIN_7 +#define ETHER_MOSI_GPIO_Port GPIOA #define Debug_Signal_2_Pin GPIO_PIN_12 #define Debug_Signal_2_GPIO_Port GPIOE #define Debug_Signal_1_Pin GPIO_PIN_10 #define Debug_Signal_1_GPIO_Port GPIOB +#define EEPROM_CS_Pin GPIO_PIN_12 +#define EEPROM_CS_GPIO_Port GPIOB +#define EEPROM_SCLK_Pin GPIO_PIN_13 +#define EEPROM_SCLK_GPIO_Port GPIOB +#define EEPROM_MISO_Pin GPIO_PIN_14 +#define EEPROM_MISO_GPIO_Port GPIOB +#define EEPROM_MOSI_Pin GPIO_PIN_15 +#define EEPROM_MOSI_GPIO_Port GPIOB #define Debug_TX_Pin GPIO_PIN_10 #define Debug_TX_GPIO_Port GPIOC #define Debug_RX_Pin GPIO_PIN_11 diff --git a/cube/Core/Inc/spi.h b/cube/Core/Inc/spi.h index 15f0a8e..ec5d534 100644 --- a/cube/Core/Inc/spi.h +++ b/cube/Core/Inc/spi.h @@ -30,6 +30,7 @@ /* USER CODE END Includes */ +extern SPI_HandleTypeDef hspi1; extern SPI_HandleTypeDef hspi2; extern SPI_HandleTypeDef hspi3; @@ -37,6 +38,7 @@ extern SPI_HandleTypeDef hspi3; /* USER CODE END Private defines */ +void MX_SPI1_Init(void); void MX_SPI2_Init(void); void MX_SPI3_Init(void); diff --git a/cube/Core/Src/gpio.c b/cube/Core/Src/gpio.c index 206ed2f..9072c29 100644 --- a/cube/Core/Src/gpio.c +++ b/cube/Core/Src/gpio.c @@ -54,7 +54,10 @@ void MX_GPIO_Init(void) |Debug_Signal_2_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(Debug_Signal_1_GPIO_Port, Debug_Signal_1_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(ETHER_CS_GPIO_Port, ETHER_CS_Pin, GPIO_PIN_RESET); + + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(GPIOB, Debug_Signal_1_Pin|EEPROM_CS_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(Frontend_Out_GPIO_Port, Frontend_Out_Pin, GPIO_PIN_RESET); @@ -75,11 +78,18 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(Loop_Status_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ - GPIO_InitStruct.Pin = Debug_Signal_1_Pin; + GPIO_InitStruct.Pin = ETHER_CS_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(Debug_Signal_1_GPIO_Port, &GPIO_InitStruct); + HAL_GPIO_Init(ETHER_CS_GPIO_Port, &GPIO_InitStruct); + + /*Configure GPIO pins : PBPin PBPin */ + GPIO_InitStruct.Pin = Debug_Signal_1_Pin|EEPROM_CS_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = Frontend_Out_Pin; diff --git a/cube/Core/Src/main.c b/cube/Core/Src/main.c index 5fb8b60..606b9bb 100644 --- a/cube/Core/Src/main.c +++ b/cube/Core/Src/main.c @@ -98,6 +98,7 @@ int main(void) MX_SPI3_Init(); MX_UART4_Init(); MX_UART5_Init(); + MX_SPI1_Init(); /* USER CODE BEGIN 2 */ my_setup_2(); diff --git a/cube/Core/Src/main.c-bak b/cube/Core/Src/main.c-bak index bc1153f..12d0431 100644 --- a/cube/Core/Src/main.c-bak +++ b/cube/Core/Src/main.c-bak @@ -93,6 +93,7 @@ int main(void) MX_SPI3_Init(); MX_UART4_Init(); MX_UART5_Init(); + MX_SPI1_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ diff --git a/cube/Core/Src/spi.c b/cube/Core/Src/spi.c index 9538448..9c98860 100644 --- a/cube/Core/Src/spi.c +++ b/cube/Core/Src/spi.c @@ -24,9 +24,32 @@ /* USER CODE END 0 */ +SPI_HandleTypeDef hspi1; SPI_HandleTypeDef hspi2; SPI_HandleTypeDef hspi3; +/* SPI1 init function */ +void MX_SPI1_Init(void) +{ + + hspi1.Instance = SPI1; + hspi1.Init.Mode = SPI_MODE_MASTER; + hspi1.Init.Direction = SPI_DIRECTION_2LINES; + hspi1.Init.DataSize = SPI_DATASIZE_8BIT; + hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; + hspi1.Init.CLKPhase = SPI_PHASE_1EDGE; + hspi1.Init.NSS = SPI_NSS_SOFT; + hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2; + hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB; + hspi1.Init.TIMode = SPI_TIMODE_DISABLE; + hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; + hspi1.Init.CRCPolynomial = 10; + if (HAL_SPI_Init(&hspi1) != HAL_OK) + { + Error_Handler(); + } + +} /* SPI2 init function */ void MX_SPI2_Init(void) { @@ -76,7 +99,35 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) { GPIO_InitTypeDef GPIO_InitStruct = {0}; - if(spiHandle->Instance==SPI2) + if(spiHandle->Instance==SPI1) + { + /* USER CODE BEGIN SPI1_MspInit 0 */ + + /* USER CODE END SPI1_MspInit 0 */ + /* SPI1 clock enable */ + __HAL_RCC_SPI1_CLK_ENABLE(); + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**SPI1 GPIO Configuration + PA5 ------> SPI1_SCK + PA6 ------> SPI1_MISO + PA7 ------> SPI1_MOSI + */ + GPIO_InitStruct.Pin = ETHER_SCLK_Pin|ETHER_MOSI_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = ETHER_MISO_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(ETHER_MISO_GPIO_Port, &GPIO_InitStruct); + + /* USER CODE BEGIN SPI1_MspInit 1 */ + + /* USER CODE END SPI1_MspInit 1 */ + } + else if(spiHandle->Instance==SPI2) { /* USER CODE BEGIN SPI2_MspInit 0 */ @@ -90,15 +141,15 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) PB14 ------> SPI2_MISO PB15 ------> SPI2_MOSI */ - GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15; + GPIO_InitStruct.Pin = EEPROM_SCLK_Pin|EEPROM_MOSI_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - GPIO_InitStruct.Pin = GPIO_PIN_14; + GPIO_InitStruct.Pin = EEPROM_MISO_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + HAL_GPIO_Init(EEPROM_MISO_GPIO_Port, &GPIO_InitStruct); /* USER CODE BEGIN SPI2_MspInit 1 */ @@ -137,7 +188,26 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle) { - if(spiHandle->Instance==SPI2) + if(spiHandle->Instance==SPI1) + { + /* USER CODE BEGIN SPI1_MspDeInit 0 */ + + /* USER CODE END SPI1_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_SPI1_CLK_DISABLE(); + + /**SPI1 GPIO Configuration + PA5 ------> SPI1_SCK + PA6 ------> SPI1_MISO + PA7 ------> SPI1_MOSI + */ + HAL_GPIO_DeInit(GPIOA, ETHER_SCLK_Pin|ETHER_MISO_Pin|ETHER_MOSI_Pin); + + /* USER CODE BEGIN SPI1_MspDeInit 1 */ + + /* USER CODE END SPI1_MspDeInit 1 */ + } + else if(spiHandle->Instance==SPI2) { /* USER CODE BEGIN SPI2_MspDeInit 0 */ @@ -150,7 +220,7 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle) PB14 ------> SPI2_MISO PB15 ------> SPI2_MOSI */ - HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15); + HAL_GPIO_DeInit(GPIOB, EEPROM_SCLK_Pin|EEPROM_MISO_Pin|EEPROM_MOSI_Pin); /* USER CODE BEGIN SPI2_MspDeInit 1 */ diff --git a/cube/Makefile b/cube/Makefile index 486694b..335b778 100644 --- a/cube/Makefile +++ b/cube/Makefile @@ -1,6 +1,6 @@ -# Processed by ../tools/insertMyCode.sh +# Processed by ../tools/insertMyCode.sh ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sun Nov 01 15:55:46 CET 2020] +# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Wed Nov 04 21:22:45 CET 2020] ########################################################################################################################## # ------------------------------------------------ @@ -36,37 +36,37 @@ BUILD_DIR = build # source ###################################### # C sources -C_SOURCES = \ -User/Src/frontend.c User/Src/show.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c hottislib/PontCoopScheduler.c \ -libmbus/mbus/mbus-protocol.c \ -Core/Src/main.c \ -Core/Src/gpio.c \ -Core/Src/adc.c \ -Core/Src/spi.c \ -Core/Src/usart.c \ -Core/Src/stm32f1xx_it.c \ -Core/Src/stm32f1xx_hal_msp.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ +C_SOURCES = \ +User/Src/frontend.c User/Src/logger.c User/Src/loopCtrl.c User/Src/main2.c User/Src/mbusComm.c User/Src/ringbuffer.c User/Src/show.c hottislib/PontCoopScheduler.c \ +libmbus/mbus/mbus-protocol.c \ +Core/Src/main.c \ +Core/Src/gpio.c \ +Core/Src/adc.c \ +Core/Src/spi.c \ +Core/Src/usart.c \ +Core/Src/stm32f1xx_it.c \ +Core/Src/stm32f1xx_hal_msp.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ Core/Src/system_stm32f1xx.c # ASM sources -ASM_SOURCES = \ +ASM_SOURCES = \ startup_stm32f103xe.s @@ -110,8 +110,8 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) AS_DEFS = # C defines -C_DEFS = \ --DUSE_HAL_DRIVER \ +C_DEFS = \ +-DUSE_HAL_DRIVER \ -DSTM32F103xE @@ -119,15 +119,15 @@ C_DEFS = \ AS_INCLUDES = # C includes -C_INCLUDES = \ --Ihottislib \ --Ilibmbus \ --IUser/Inc \ --ICore/Inc \ --IDrivers/STM32F1xx_HAL_Driver/Inc \ --IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ --IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ --IDrivers/CMSIS/Include \ +C_INCLUDES = \ +-Ihottislib \ +-Ilibmbus \ +-IUser/Inc \ +-ICore/Inc \ +-IDrivers/STM32F1xx_HAL_Driver/Inc \ +-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ +-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ +-IDrivers/CMSIS/Include \ -IDrivers/CMSIS/Include diff --git a/cube/Makefile-bak b/cube/Makefile-bak index 5243c18..9795802 100644 --- a/cube/Makefile-bak +++ b/cube/Makefile-bak @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sun Nov 01 15:55:46 CET 2020] +# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Wed Nov 04 21:22:45 CET 2020] ########################################################################################################################## # ------------------------------------------------ diff --git a/cube/cube.ioc b/cube/cube.ioc index 4ce2c72..d62fef0 100644 --- a/cube/cube.ioc +++ b/cube/cube.ioc @@ -14,41 +14,47 @@ Mcu.Family=STM32F1 Mcu.IP0=ADC1 Mcu.IP1=NVIC Mcu.IP2=RCC -Mcu.IP3=SPI2 -Mcu.IP4=SPI3 -Mcu.IP5=SYS -Mcu.IP6=UART4 -Mcu.IP7=UART5 -Mcu.IPNb=8 +Mcu.IP3=SPI1 +Mcu.IP4=SPI2 +Mcu.IP5=SPI3 +Mcu.IP6=SYS +Mcu.IP7=UART4 +Mcu.IP8=UART5 +Mcu.IPNb=9 Mcu.Name=STM32F103V(C-D-E)Tx Mcu.Package=LQFP100 Mcu.Pin0=PE2 Mcu.Pin1=PE3 -Mcu.Pin10=PB13 -Mcu.Pin11=PB14 -Mcu.Pin12=PB15 -Mcu.Pin13=PA13 -Mcu.Pin14=PA14 -Mcu.Pin15=PC10 -Mcu.Pin16=PC11 -Mcu.Pin17=PC12 -Mcu.Pin18=PD1 -Mcu.Pin19=PD2 +Mcu.Pin10=PA6 +Mcu.Pin11=PA7 +Mcu.Pin12=PE12 +Mcu.Pin13=PB10 +Mcu.Pin14=PB12 +Mcu.Pin15=PB13 +Mcu.Pin16=PB14 +Mcu.Pin17=PB15 +Mcu.Pin18=PA13 +Mcu.Pin19=PA14 Mcu.Pin2=PE4 -Mcu.Pin20=PB3 -Mcu.Pin21=PB4 -Mcu.Pin22=PB5 -Mcu.Pin23=VP_SYS_VS_Systick +Mcu.Pin20=PC10 +Mcu.Pin21=PC11 +Mcu.Pin22=PC12 +Mcu.Pin23=PD1 +Mcu.Pin24=PD2 +Mcu.Pin25=PB3 +Mcu.Pin26=PB4 +Mcu.Pin27=PB5 +Mcu.Pin28=VP_SYS_VS_Systick Mcu.Pin3=PE5 Mcu.Pin4=PE6 Mcu.Pin5=OSC_IN Mcu.Pin6=OSC_OUT Mcu.Pin7=PA1 -Mcu.Pin8=PE12 -Mcu.Pin9=PB10 -Mcu.PinsNb=24 +Mcu.Pin8=PA4 +Mcu.Pin9=PA5 +Mcu.PinsNb=29 Mcu.ThirdPartyNb=0 -Mcu.UserConstants=debugUart,huart4;mbusUart,huart5;frontendAdc,hadc1 +Mcu.UserConstants=debugUart,huart4;mbusUart,huart5;frontendAdc,hadc1;eepromSpi,hspi2;etherSpi,hspi1 Mcu.UserName=STM32F103VCTx MxCube.Version=6.0.0 MxDb.Version=DB.6.0.0 @@ -78,14 +84,40 @@ PA13.Mode=Serial_Wire PA13.Signal=SYS_JTMS-SWDIO PA14.Mode=Serial_Wire PA14.Signal=SYS_JTCK-SWCLK +PA4.GPIOParameters=GPIO_Label +PA4.GPIO_Label=ETHER_CS +PA4.Locked=true +PA4.Signal=GPIO_Output +PA5.GPIOParameters=GPIO_Label +PA5.GPIO_Label=ETHER_SCLK +PA5.Mode=Full_Duplex_Master +PA5.Signal=SPI1_SCK +PA6.GPIOParameters=GPIO_Label +PA6.GPIO_Label=ETHER_MISO +PA6.Mode=Full_Duplex_Master +PA6.Signal=SPI1_MISO +PA7.GPIOParameters=GPIO_Label +PA7.GPIO_Label=ETHER_MOSI +PA7.Mode=Full_Duplex_Master +PA7.Signal=SPI1_MOSI PB10.GPIOParameters=GPIO_Label PB10.GPIO_Label=Debug_Signal_1 PB10.Locked=true PB10.Signal=GPIO_Output +PB12.GPIOParameters=GPIO_Label +PB12.GPIO_Label=EEPROM_CS +PB12.Locked=true +PB12.Signal=GPIO_Output +PB13.GPIOParameters=GPIO_Label +PB13.GPIO_Label=EEPROM_SCLK PB13.Mode=Full_Duplex_Master PB13.Signal=SPI2_SCK +PB14.GPIOParameters=GPIO_Label +PB14.GPIO_Label=EEPROM_MISO PB14.Mode=Full_Duplex_Master PB14.Signal=SPI2_MISO +PB15.GPIOParameters=GPIO_Label +PB15.GPIO_Label=EEPROM_MOSI PB15.Mode=Full_Duplex_Master PB15.Signal=SPI2_MOSI PB3.Mode=Full_Duplex_Master @@ -201,6 +233,11 @@ SH.ADCx_IN1.0=ADC1_IN1,IN1 SH.ADCx_IN1.ConfNb=1 SH.GPXTI4.0=GPIO_EXTI4 SH.GPXTI4.ConfNb=1 +SPI1.CalculateBaudRate=18.0 MBits/s +SPI1.Direction=SPI_DIRECTION_2LINES +SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate +SPI1.Mode=SPI_MODE_MASTER +SPI1.VirtualType=VM_MASTER SPI2.CalculateBaudRate=18.0 MBits/s SPI2.Direction=SPI_DIRECTION_2LINES SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate