From 0ddea60a5043fa01fe0c6aab7c6f7faeac01e976 Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Wed, 8 Mar 2023 20:20:01 +0100 Subject: [PATCH] Make CAN work --- AZURE_RTOS/App/app_azure_rtos.c | 11 +++ AZURE_RTOS/App/app_azure_rtos.h | 1 + Core/Inc/main.h | 5 ++ Core/Inc/stm32h7xx_it.h | 2 + Core/Inc/vehicle.h | 8 ++ Core/Src/main.c | 20 ++--- Core/Src/stm32h7xx_hal_msp.c | 8 ++ Core/Src/stm32h7xx_it.c | 29 +++++++ Core/Src/tx_initialize_low_level.s | 6 +- Core/Src/vehicle.c | 75 ++++++++++++++++ Makefile | 2 +- STM32Make.make | 1 + steering-wheel.ioc | 133 ++++++++++++++++------------- 13 files changed, 227 insertions(+), 74 deletions(-) create mode 100644 Core/Inc/vehicle.h create mode 100644 Core/Src/vehicle.c diff --git a/AZURE_RTOS/App/app_azure_rtos.c b/AZURE_RTOS/App/app_azure_rtos.c index 9be75ba..c1126fe 100644 --- a/AZURE_RTOS/App/app_azure_rtos.c +++ b/AZURE_RTOS/App/app_azure_rtos.c @@ -30,6 +30,7 @@ #include "tx_api.h" #include "tx_port.h" #include "ui.h" +#include "vehicle.h" /* USER CODE END Includes */ @@ -64,6 +65,7 @@ static TX_BYTE_POOL tx_app_byte_pool; /* USER CODE BEGIN PV */ TX_THREAD app_thread; TX_THREAD ui_thread; +TX_THREAD vehicle_thread; TX_QUEUE gui_button_queue; /* USER CODE END PV */ @@ -179,6 +181,15 @@ VOID tx_application_define(VOID *first_unused_memory) { Error_Handler(); } + void *vehicle_thread_stack = mem; + mem += THREAD_STACK_SIZE; + if (tx_thread_create(&vehicle_thread, "Vehicle Thread", vehicle_thread_entry, + &hfdcan1, vehicle_thread_stack, THREAD_STACK_SIZE, + THREAD_PRIO_VEHICLE, THREAD_PRIO_VEHICLE, 0, + TX_AUTO_START) != TX_SUCCESS) { + Error_Handler(); + } + if (MX_TouchGFX_Init(mem) != TX_SUCCESS) { Error_Handler(); } diff --git a/AZURE_RTOS/App/app_azure_rtos.h b/AZURE_RTOS/App/app_azure_rtos.h index f2bf614..aba4384 100644 --- a/AZURE_RTOS/App/app_azure_rtos.h +++ b/AZURE_RTOS/App/app_azure_rtos.h @@ -45,6 +45,7 @@ extern "C" { #define THREAD_PRIO_APP 10 #define THREAD_PRIO_UI 6 +#define THREAD_PRIO_VEHICLE 7 #define UI_QUEUE_SIZE 10 /* USER CODE END EC */ diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 281e3a0..5d39da9 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -43,6 +43,7 @@ extern "C" { /* USER CODE BEGIN EC */ extern volatile int ltdc_cb_triggered; extern TX_QUEUE gui_button_queue; +extern FDCAN_HandleTypeDef hfdcan1; /* USER CODE END EC */ /* Exported macro ------------------------------------------------------------*/ @@ -62,12 +63,16 @@ void Error_Handler(void); /* Private defines -----------------------------------------------------------*/ #define ENC1A_Pin GPIO_PIN_3 #define ENC1A_GPIO_Port GPIOE +#define ENC1A_EXTI_IRQn EXTI3_IRQn #define ENC1B_Pin GPIO_PIN_4 #define ENC1B_GPIO_Port GPIOE +#define ENC1B_EXTI_IRQn EXTI4_IRQn #define ENC2A_Pin GPIO_PIN_5 #define ENC2A_GPIO_Port GPIOE +#define ENC2A_EXTI_IRQn EXTI9_5_IRQn #define ENC2B_Pin GPIO_PIN_6 #define ENC2B_GPIO_Port GPIOE +#define ENC2B_EXTI_IRQn EXTI9_5_IRQn #define BTN1_Pin GPIO_PIN_0 #define BTN1_GPIO_Port GPIOF #define BTN2_Pin GPIO_PIN_1 diff --git a/Core/Inc/stm32h7xx_it.h b/Core/Inc/stm32h7xx_it.h index 8a3d2ed..c1e0dbd 100644 --- a/Core/Inc/stm32h7xx_it.h +++ b/Core/Inc/stm32h7xx_it.h @@ -54,6 +54,8 @@ void UsageFault_Handler(void); void DebugMon_Handler(void); void EXTI3_IRQHandler(void); void EXTI4_IRQHandler(void); +void FDCAN1_IT0_IRQHandler(void); +void FDCAN1_IT1_IRQHandler(void); void EXTI9_5_IRQHandler(void); void TIM6_DAC_IRQHandler(void); void LTDC_IRQHandler(void); diff --git a/Core/Inc/vehicle.h b/Core/Inc/vehicle.h new file mode 100644 index 0000000..22128f7 --- /dev/null +++ b/Core/Inc/vehicle.h @@ -0,0 +1,8 @@ +#ifndef __INC_VEHICLE_H +#define __INC_VEHICLE_H + +#include "tx_port.h" + +void vehicle_thread_entry(ULONG hfdcan_addr); + +#endif // __INC_VEHICLE_H diff --git a/Core/Src/main.c b/Core/Src/main.c index d6f676a..7bf18a6 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -169,7 +169,7 @@ void SystemClock_Config(void) { /** Configure the main internal regulator output voltage */ - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) { } @@ -187,9 +187,9 @@ void SystemClock_Config(void) { RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = 4; - RCC_OscInitStruct.PLL.PLLN = 8; + RCC_OscInitStruct.PLL.PLLN = 20; RCC_OscInitStruct.PLL.PLLP = 2; - RCC_OscInitStruct.PLL.PLLQ = 128; + RCC_OscInitStruct.PLL.PLLQ = 4; RCC_OscInitStruct.PLL.PLLR = 2; RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3; RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; @@ -211,7 +211,7 @@ void SystemClock_Config(void) { RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; - if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) { Error_Handler(); } } @@ -300,18 +300,18 @@ static void MX_FDCAN1_Init(void) { hfdcan1.Init.AutoRetransmission = DISABLE; hfdcan1.Init.TransmitPause = DISABLE; hfdcan1.Init.ProtocolException = DISABLE; - hfdcan1.Init.NominalPrescaler = 16; + hfdcan1.Init.NominalPrescaler = 2; hfdcan1.Init.NominalSyncJumpWidth = 1; - hfdcan1.Init.NominalTimeSeg1 = 2; - hfdcan1.Init.NominalTimeSeg2 = 2; + hfdcan1.Init.NominalTimeSeg1 = 63; + hfdcan1.Init.NominalTimeSeg2 = 16; hfdcan1.Init.DataPrescaler = 1; hfdcan1.Init.DataSyncJumpWidth = 1; hfdcan1.Init.DataTimeSeg1 = 1; hfdcan1.Init.DataTimeSeg2 = 1; hfdcan1.Init.MessageRAMOffset = 0; - hfdcan1.Init.StdFiltersNbr = 0; + hfdcan1.Init.StdFiltersNbr = 1; hfdcan1.Init.ExtFiltersNbr = 0; - hfdcan1.Init.RxFifo0ElmtsNbr = 0; + hfdcan1.Init.RxFifo0ElmtsNbr = 16; hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8; hfdcan1.Init.RxFifo1ElmtsNbr = 0; hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8; @@ -319,7 +319,7 @@ static void MX_FDCAN1_Init(void) { hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8; hfdcan1.Init.TxEventsNbr = 0; hfdcan1.Init.TxBuffersNbr = 0; - hfdcan1.Init.TxFifoQueueElmtsNbr = 0; + hfdcan1.Init.TxFifoQueueElmtsNbr = 1; hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8; if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK) { diff --git a/Core/Src/stm32h7xx_hal_msp.c b/Core/Src/stm32h7xx_hal_msp.c index c63255f..1ed55ee 100644 --- a/Core/Src/stm32h7xx_hal_msp.c +++ b/Core/Src/stm32h7xx_hal_msp.c @@ -205,6 +205,11 @@ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* hfdcan) GPIO_InitStruct.Alternate = GPIO_AF9_FDCAN1; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); + /* FDCAN1 interrupt Init */ + HAL_NVIC_SetPriority(FDCAN1_IT0_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(FDCAN1_IT0_IRQn); + HAL_NVIC_SetPriority(FDCAN1_IT1_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(FDCAN1_IT1_IRQn); /* USER CODE BEGIN FDCAN1_MspInit 1 */ /* USER CODE END FDCAN1_MspInit 1 */ @@ -234,6 +239,9 @@ void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* hfdcan) */ HAL_GPIO_DeInit(GPIOD, GPIO_PIN_0|GPIO_PIN_1); + /* FDCAN1 interrupt DeInit */ + HAL_NVIC_DisableIRQ(FDCAN1_IT0_IRQn); + HAL_NVIC_DisableIRQ(FDCAN1_IT1_IRQn); /* USER CODE BEGIN FDCAN1_MspDeInit 1 */ /* USER CODE END FDCAN1_MspDeInit 1 */ diff --git a/Core/Src/stm32h7xx_it.c b/Core/Src/stm32h7xx_it.c index d117266..b290ffc 100644 --- a/Core/Src/stm32h7xx_it.c +++ b/Core/Src/stm32h7xx_it.c @@ -55,6 +55,7 @@ /* USER CODE END 0 */ /* External variables --------------------------------------------------------*/ +extern FDCAN_HandleTypeDef hfdcan1; extern LTDC_HandleTypeDef hltdc; extern TIM_HandleTypeDef htim6; @@ -188,6 +189,34 @@ void EXTI4_IRQHandler(void) /* USER CODE END EXTI4_IRQn 1 */ } +/** + * @brief This function handles FDCAN1 interrupt 0. + */ +void FDCAN1_IT0_IRQHandler(void) +{ + /* USER CODE BEGIN FDCAN1_IT0_IRQn 0 */ + + /* USER CODE END FDCAN1_IT0_IRQn 0 */ + HAL_FDCAN_IRQHandler(&hfdcan1); + /* USER CODE BEGIN FDCAN1_IT0_IRQn 1 */ + + /* USER CODE END FDCAN1_IT0_IRQn 1 */ +} + +/** + * @brief This function handles FDCAN1 interrupt 1. + */ +void FDCAN1_IT1_IRQHandler(void) +{ + /* USER CODE BEGIN FDCAN1_IT1_IRQn 0 */ + + /* USER CODE END FDCAN1_IT1_IRQn 0 */ + HAL_FDCAN_IRQHandler(&hfdcan1); + /* USER CODE BEGIN FDCAN1_IT1_IRQn 1 */ + + /* USER CODE END FDCAN1_IT1_IRQn 1 */ +} + /** * @brief This function handles EXTI line[9:5] interrupts. */ diff --git a/Core/Src/tx_initialize_low_level.s b/Core/Src/tx_initialize_low_level.s index b802391..45d8237 100644 --- a/Core/Src/tx_initialize_low_level.s +++ b/Core/Src/tx_initialize_low_level.s @@ -66,7 +66,7 @@ .global __Vectors @ @ -SYSTEM_CLOCK = 64000000 +SYSTEM_CLOCK = 160000000 SYSTICK_CYCLES = ((SYSTEM_CLOCK / 100) -1) .text 32 @@ -287,7 +287,7 @@ __tx_DBGHandler: EXTERN _tx_execution_isr_exit ; ; -SYSTEM_CLOCK EQU 64000000 +SYSTEM_CLOCK EQU 160000000 SYSTICK_CYCLES EQU ((SYSTEM_CLOCK / 100) -1) #ifdef USE_DYNAMIC_MEMORY_ALLOCATION RSEG FREE_MEM:DATA @@ -470,7 +470,7 @@ SysTick_Handler: @ @ -SYSTEM_CLOCK = 64000000 +SYSTEM_CLOCK = 160000000 SYSTICK_CYCLES = ((SYSTEM_CLOCK / 100) -1) .text 32 diff --git a/Core/Src/vehicle.c b/Core/Src/vehicle.c new file mode 100644 index 0000000..0881543 --- /dev/null +++ b/Core/Src/vehicle.c @@ -0,0 +1,75 @@ +#include "vehicle.h" + +#include "main.h" +#include "stm32h7xx.h" +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_fdcan.h" +#include "stm32h7xx_hal_gpio.h" +#include "tx_api.h" +#include "ui.h" + +FDCAN_HandleTypeDef *hcan; + +void vehicle_thread_entry(ULONG hfdcan_addr) { + hcan = (void *)hfdcan_addr; + + FDCAN_FilterTypeDef filter; + filter.IdType = FDCAN_STANDARD_ID; + filter.FilterIndex = 0; + filter.FilterType = FDCAN_FILTER_MASK; + filter.FilterConfig = FDCAN_FILTER_TO_RXFIFO0; + filter.FilterID1 = 0x123; + filter.FilterID2 = 0x7FF; + + if (HAL_FDCAN_ConfigFilter(hcan, &filter) != HAL_OK) { + Error_Handler(); + } + // Reject non-matching messages + if (HAL_FDCAN_ConfigGlobalFilter(hcan, FDCAN_REJECT, FDCAN_REJECT, + FDCAN_REJECT_REMOTE, + FDCAN_REJECT_REMOTE) != HAL_OK) { + Error_Handler(); + } + if (HAL_FDCAN_Start(hcan)) { + Error_Handler(); + } + if (HAL_FDCAN_ActivateNotification(hcan, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != + HAL_OK) { + Error_Handler(); + } + + FDCAN_TxHeaderTypeDef tx_header; + tx_header.IdType = FDCAN_STANDARD_ID; + tx_header.TxFrameType = FDCAN_DATA_FRAME; + tx_header.ErrorStateIndicator = FDCAN_ESI_PASSIVE; + tx_header.BitRateSwitch = FDCAN_BRS_OFF; + tx_header.FDFormat = FDCAN_CLASSIC_CAN; + tx_header.TxEventFifoControl = FDCAN_NO_TX_EVENTS; + tx_header.MessageMarker = 0; + while (1) { + tx_header.Identifier = 0x456; + tx_header.DataLength = FDCAN_DLC_BYTES_2; + uint8_t data[] = {0xFF, 0xEE}; + if (HAL_FDCAN_GetTxFifoFreeLevel(hcan) != 0) { + HAL_FDCAN_AddMessageToTxFifoQ(hcan, &tx_header, data); + } + tx_thread_sleep(10); + } +} + +void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, + uint32_t RxFifo0ITs) { + if (hfdcan != hcan || (RxFifo0ITs & FDCAN_IT_RX_FIFO0_NEW_MESSAGE) == RESET) { + return; + } + + static FDCAN_RxHeaderTypeDef header; + static uint8_t data[8]; + if (HAL_FDCAN_GetRxMessage(hcan, FDCAN_RX_FIFO0, &header, data) != HAL_OK) { + Error_Handler(); + } + + if (header.IdType != FDCAN_STANDARD_ID || header.Identifier == 0x123) { + HAL_GPIO_TogglePin(STATUS2_GPIO_Port, STATUS2_Pin); + } +} diff --git a/Makefile b/Makefile index d185863..d655833 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Tue Mar 07 19:47:03 CET 2023] +# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Wed Mar 08 15:59:48 CET 2023] ########################################################################################################################## # ------------------------------------------------ diff --git a/STM32Make.make b/STM32Make.make index 5b459b8..021013a 100644 --- a/STM32Make.make +++ b/STM32Make.make @@ -45,6 +45,7 @@ Core/Src/stm32h7xx_hal_timebase_tim.c \ Core/Src/stm32h7xx_it.c \ Core/Src/system_stm32h7xx.c \ Core/Src/ui.c \ +Core/Src/vehicle.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c \ diff --git a/steering-wheel.ioc b/steering-wheel.ioc index 0a9e8e0..9abc3a9 100644 --- a/steering-wheel.ioc +++ b/steering-wheel.ioc @@ -5,10 +5,18 @@ CAD.pinconfig= CAD.provider= DMA2D.ColorMode=DMA2D_OUTPUT_RGB888 DMA2D.IPParameters=ColorMode -FDCAN1.CalculateBaudRateNominal=12500 -FDCAN1.CalculateTimeBitNominal=80000 -FDCAN1.CalculateTimeQuantumNominal=16000.0 -FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal +FDCAN1.CalculateBaudRateNominal=500000 +FDCAN1.CalculateTimeBitNominal=2000 +FDCAN1.CalculateTimeQuantumNominal=25.0 +FDCAN1.FrameFormat=FDCAN_FRAME_CLASSIC +FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,NominalPrescaler,NominalTimeSeg1,NominalSyncJumpWidth,NominalTimeSeg2,FrameFormat,StdFiltersNbr,RxFifo0ElmtsNbr,TxFifoQueueElmtsNbr +FDCAN1.NominalPrescaler=2 +FDCAN1.NominalSyncJumpWidth=1 +FDCAN1.NominalTimeSeg1=63 +FDCAN1.NominalTimeSeg2=16 +FDCAN1.RxFifo0ElmtsNbr=16 +FDCAN1.StdFiltersNbr=1 +FDCAN1.TxFifoQueueElmtsNbr=1 File.Version=6 GPIO.groupedBy=Show All JPEG.IPParameters=JPEG_RGB_FORMAT @@ -136,6 +144,8 @@ NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:fals NVIC.EXTI3_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true NVIC.EXTI4_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true +NVIC.FDCAN1_IT0_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true +NVIC.FDCAN1_IT1_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.LTDC_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true\:true @@ -407,88 +417,91 @@ ProjectManager.TargetToolchain=Makefile ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=false ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA2D_Init-DMA2D-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,14-MX_TouchGFX_Init-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,15-MX_TouchGFX_Process-STMicroelectronics.X-CUBE-TOUCHGFX.4.21.2-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true -RCC.ADCFreq_Value=129000000 -RCC.AHB12Freq_Value=64000000 -RCC.AHB4Freq_Value=64000000 -RCC.APB1Freq_Value=32000000 -RCC.APB2Freq_Value=32000000 -RCC.APB3Freq_Value=32000000 -RCC.APB4Freq_Value=32000000 -RCC.AXIClockFreq_Value=64000000 -RCC.CDCPREFreq_Value=64000000 +RCC.ADCFreq_Value=64000000 +RCC.AHB12Freq_Value=160000000 +RCC.AHB4Freq_Value=160000000 +RCC.APB1Freq_Value=80000000 +RCC.APB2Freq_Value=80000000 +RCC.APB3Freq_Value=80000000 +RCC.APB4Freq_Value=80000000 +RCC.AXIClockFreq_Value=160000000 +RCC.CDCPREFreq_Value=160000000 RCC.CDPPRE=RCC_APB3_DIV2 RCC.CDPPRE1=RCC_APB1_DIV2 RCC.CDPPRE2=RCC_APB2_DIV2 RCC.CECFreq_Value=32000 RCC.CKPERFreq_Value=64000000 -RCC.CortexFreq_Value=64000000 -RCC.CpuClockFreq_Value=64000000 +RCC.CortexFreq_Value=160000000 +RCC.CpuClockFreq_Value=160000000 RCC.DAC1Freq_Value=32000 RCC.DAC2Freq_Value=32000 -RCC.DFSDM2ACLkFreq_Value=32000000 -RCC.DFSDM2Freq_Value=32000000 -RCC.DFSDMACLkFreq_Value=1000000 -RCC.DFSDMFreq_Value=32000000 +RCC.DFSDM2ACLkFreq_Value=80000000 +RCC.DFSDM2Freq_Value=80000000 +RCC.DFSDMACLkFreq_Value=80000000 +RCC.DFSDMFreq_Value=80000000 RCC.DIVM1=4 +RCC.DIVM2=4 RCC.DIVM3=4 -RCC.DIVN1=8 +RCC.DIVN1=20 +RCC.DIVN2=8 RCC.DIVN3=8 -RCC.DIVP1Freq_Value=64000000 -RCC.DIVP2Freq_Value=129000000 +RCC.DIVP1Freq_Value=160000000 +RCC.DIVP2Freq_Value=64000000 RCC.DIVP3Freq_Value=64000000 -RCC.DIVQ1=128 -RCC.DIVQ1Freq_Value=1000000 -RCC.DIVQ2Freq_Value=129000000 +RCC.DIVQ1=4 +RCC.DIVQ1Freq_Value=80000000 +RCC.DIVQ2=3 +RCC.DIVQ2Freq_Value=42666666.666666664 RCC.DIVQ3Freq_Value=64000000 -RCC.DIVR1Freq_Value=64000000 -RCC.DIVR2Freq_Value=129000000 +RCC.DIVR1Freq_Value=160000000 +RCC.DIVR2Freq_Value=64000000 RCC.DIVR3=14 RCC.DIVR3Freq_Value=9142857.142857144 -RCC.FDCANFreq_Value=1000000 -RCC.FMCFreq_Value=64000000 +RCC.FDCANFreq_Value=80000000 +RCC.FMCFreq_Value=160000000 RCC.FamilyName=M -RCC.HCLK3ClockFreq_Value=64000000 -RCC.HCLKFreq_Value=64000000 +RCC.HCLK3ClockFreq_Value=160000000 +RCC.HCLKFreq_Value=160000000 RCC.HSE_VALUE=24000000 -RCC.I2C123Freq_Value=32000000 -RCC.I2C4Freq_Value=32000000 -RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CDCPREFreq_Value,CDPPRE,CDPPRE1,CDPPRE2,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,DAC1Freq_Value,DAC2Freq_Value,DFSDM2ACLkFreq_Value,DFSDM2Freq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM3,DIVN1,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HSE_VALUE,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLL3FRACN,PLLFRACN,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI2AFreq_Value,SAI2BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SRDPPRE,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value -RCC.LPTIM1Freq_Value=32000000 -RCC.LPTIM2Freq_Value=32000000 -RCC.LPTIM345Freq_Value=32000000 -RCC.LPUART1Freq_Value=32000000 +RCC.I2C123Freq_Value=80000000 +RCC.I2C4Freq_Value=80000000 +RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CDCPREFreq_Value,CDPPRE,CDPPRE1,CDPPRE2,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,DAC1Freq_Value,DAC2Freq_Value,DFSDM2ACLkFreq_Value,DFSDM2Freq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HSE_VALUE,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLL3FRACN,PLLFRACN,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI2AFreq_Value,SAI2BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SRDPPRE,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value +RCC.LPTIM1Freq_Value=80000000 +RCC.LPTIM2Freq_Value=80000000 +RCC.LPTIM345Freq_Value=80000000 +RCC.LPUART1Freq_Value=80000000 RCC.LTDCFreq_Value=9142857.142857144 RCC.MCO1PinFreq_Value=64000000 -RCC.MCO2PinFreq_Value=64000000 +RCC.MCO2PinFreq_Value=160000000 RCC.PLL2FRACN=0 RCC.PLL3FRACN=0 RCC.PLLFRACN=0 -RCC.QSPIFreq_Value=64000000 +RCC.QSPIFreq_Value=160000000 RCC.RNGFreq_Value=48000000 RCC.RTCFreq_Value=32000 -RCC.SAI1Freq_Value=1000000 -RCC.SAI2AFreq_Value=1000000 -RCC.SAI2BFreq_Value=1000000 -RCC.SDMMCFreq_Value=1000000 -RCC.SPDIFRXFreq_Value=1000000 -RCC.SPI123Freq_Value=1000000 -RCC.SPI45Freq_Value=32000000 -RCC.SPI6Freq_Value=32000000 +RCC.SAI1Freq_Value=80000000 +RCC.SAI2AFreq_Value=80000000 +RCC.SAI2BFreq_Value=80000000 +RCC.SDMMCFreq_Value=80000000 +RCC.SPDIFRXFreq_Value=80000000 +RCC.SPI123Freq_Value=80000000 +RCC.SPI45Freq_Value=80000000 +RCC.SPI6Freq_Value=80000000 RCC.SRDPPRE=RCC_APB4_DIV2 -RCC.SWPMI1Freq_Value=32000000 -RCC.SYSCLKFreq_VALUE=64000000 +RCC.SWPMI1Freq_Value=80000000 +RCC.SYSCLKFreq_VALUE=160000000 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK -RCC.Tim1OutputFreq_Value=64000000 -RCC.Tim2OutputFreq_Value=64000000 -RCC.TraceFreq_Value=64000000 -RCC.USART16Freq_Value=32000000 -RCC.USART234578Freq_Value=32000000 -RCC.USBFreq_Value=1000000 -RCC.VCO1OutputFreq_Value=128000000 -RCC.VCO2OutputFreq_Value=258000000 +RCC.Tim1OutputFreq_Value=160000000 +RCC.Tim2OutputFreq_Value=160000000 +RCC.TraceFreq_Value=160000000 +RCC.USART16Freq_Value=80000000 +RCC.USART234578Freq_Value=80000000 +RCC.USBFreq_Value=80000000 +RCC.VCO1OutputFreq_Value=320000000 +RCC.VCO2OutputFreq_Value=128000000 RCC.VCO3OutputFreq_Value=128000000 RCC.VCOInput1Freq_Value=16000000 -RCC.VCOInput2Freq_Value=2000000 +RCC.VCOInput2Freq_Value=16000000 RCC.VCOInput3Freq_Value=16000000 SH.GPXTI3.0=GPIO_EXTI3 SH.GPXTI3.ConfNb=1 @@ -511,7 +524,7 @@ SH.S_TIM4_CH1.ConfNb=1 SH.S_TIM4_CH2.0=TIM4_CH2,PWM Generation2 CH2 SH.S_TIM4_CH2.ConfNb=1 SPI3.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2 -SPI3.CalculateBaudRate=500.0 KBits/s +SPI3.CalculateBaudRate=40.0 MBits/s SPI3.Direction=SPI_DIRECTION_2LINES_TXONLY SPI3.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler SPI3.Mode=SPI_MODE_MASTER