diff --git a/.mxproject b/.mxproject index 3639db6..6fc7506 100644 --- a/.mxproject +++ b/.mxproject @@ -9,7 +9,7 @@ CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTU [PreviousUsedKeilFiles] SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\adc.c;..\Core\Src\dac.c;..\Core\Src\dma.c;..\Core\Src\spi.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32l4xx_it.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_utils.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_exti.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_gpio.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_adc.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dma.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_dac.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_spi.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_pwr.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_tim.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_usart.c;..\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c;..\Drivers\CMSIS\Device\ST\STM32L4xx\Source\Templates\system_stm32l4xx.c;..\Core\Src\system_stm32l4xx.c;;; HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\CMSIS\Device\ST\STM32L4xx\Include;..\Drivers\CMSIS\Include;..\Middlewares\ST\ARM\DSP\Inc;..\Core\Inc; -CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L476xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1; +CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:11059200;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L476xx;USE_FULL_LL_DRIVER;HSE_VALUE:11059200;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:16000000;EXTERNALSAI1_CLOCK_VALUE:2097000;EXTERNALSAI2_CLOCK_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1; [] SourceFiles=;; diff --git a/Core/Src/main.c b/Core/Src/main.c index aaf3110..dc60a43 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -86,9 +86,9 @@ int fputc(int ch, FILE *stream) /* USER CODE END 0 */ /** - * @brief The application entry point. - * @retval int - */ + * @brief The application entry point. + * @retval int + */ int main(void) { /* USER CODE BEGIN 1 */ @@ -104,7 +104,7 @@ int main(void) NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); /* SysTick_IRQn interrupt configuration */ - NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0)); + NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),15, 0)); /* USER CODE BEGIN Init */ @@ -113,7 +113,7 @@ int main(void) /* Configure the system clock */ SystemClock_Config(); - /* Configure the peripherals common clocks */ +/* Configure the peripherals common clocks */ PeriphCommonClock_Config(); /* USER CODE BEGIN SysInit */ @@ -165,13 +165,13 @@ int main(void) } /** - * @brief System Clock Configuration - * @retval None - */ + * @brief System Clock Configuration + * @retval None + */ void SystemClock_Config(void) { LL_FLASH_SetLatency(LL_FLASH_LATENCY_0); - while (LL_FLASH_GetLatency() != LL_FLASH_LATENCY_0) + while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_0) { } LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); @@ -180,23 +180,26 @@ void SystemClock_Config(void) } LL_RCC_HSE_Enable(); - /* Wait till HSE is ready */ - while (LL_RCC_HSE_IsReady() != 1) + /* Wait till HSE is ready */ + while(LL_RCC_HSE_IsReady() != 1) { + } LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 12, LL_RCC_PLLR_DIV_6); LL_RCC_PLL_EnableDomain_SYS(); LL_RCC_PLL_Enable(); - /* Wait till PLL is ready */ - while (LL_RCC_PLL_IsReady() != 1) + /* Wait till PLL is ready */ + while(LL_RCC_PLL_IsReady() != 1) { + } LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); - /* Wait till System clock is ready */ - while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) + /* Wait till System clock is ready */ + while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { + } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2); LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); @@ -208,18 +211,19 @@ void SystemClock_Config(void) } /** - * @brief Peripherals Common Clock Configuration - * @retval None - */ + * @brief Peripherals Common Clock Configuration + * @retval None + */ void PeriphCommonClock_Config(void) { LL_RCC_PLLSAI1_ConfigDomain_ADC(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_2, 12, LL_RCC_PLLSAI1R_DIV_8); LL_RCC_PLLSAI1_EnableDomain_ADC(); LL_RCC_PLLSAI1_Enable(); - /* Wait till PLLSAI1 is ready */ - while (LL_RCC_PLLSAI1_IsReady() != 1) + /* Wait till PLLSAI1 is ready */ + while(LL_RCC_PLLSAI1_IsReady() != 1) { + } } @@ -228,9 +232,9 @@ void PeriphCommonClock_Config(void) /* USER CODE END 4 */ /** - * @brief This function is executed in case of error occurrence. - * @retval None - */ + * @brief This function is executed in case of error occurrence. + * @retval None + */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ @@ -242,14 +246,14 @@ void Error_Handler(void) /* USER CODE END Error_Handler_Debug */ } -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ diff --git a/Core/Src/tim.c b/Core/Src/tim.c index 6e5ff40..960c85c 100644 --- a/Core/Src/tim.c +++ b/Core/Src/tim.c @@ -44,7 +44,7 @@ void MX_TIM2_Init(void) /* USER CODE END TIM2_Init 1 */ TIM_InitStruct.Prescaler = 0; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; - TIM_InitStruct.Autoreload = 3999; + TIM_InitStruct.Autoreload = 5529; TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; LL_TIM_Init(TIM2, &TIM_InitStruct); LL_TIM_EnableARRPreload(TIM2); @@ -98,7 +98,7 @@ void MX_TIM3_Init(void) /* USER CODE END TIM3_Init 1 */ TIM_InitStruct.Prescaler = 0; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; - TIM_InitStruct.Autoreload = 3999; + TIM_InitStruct.Autoreload = 11; TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; LL_TIM_Init(TIM3, &TIM_InitStruct); LL_TIM_EnableARRPreload(TIM3); @@ -152,7 +152,7 @@ void MX_TIM6_Init(void) /* USER CODE BEGIN TIM6_Init 1 */ /* USER CODE END TIM6_Init 1 */ - TIM_InitStruct.Prescaler = 399; + TIM_InitStruct.Prescaler = 552; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; TIM_InitStruct.Autoreload = 99; LL_TIM_Init(TIM6, &TIM_InitStruct); @@ -184,7 +184,7 @@ void MX_TIM7_Init(void) /* USER CODE BEGIN TIM7_Init 1 */ /* USER CODE END TIM7_Init 1 */ - TIM_InitStruct.Prescaler = 399; + TIM_InitStruct.Prescaler = 552; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; TIM_InitStruct.Autoreload = 249; LL_TIM_Init(TIM7, &TIM_InitStruct); @@ -216,7 +216,7 @@ void MX_TIM16_Init(void) /* USER CODE BEGIN TIM16_Init 1 */ /* USER CODE END TIM16_Init 1 */ - TIM_InitStruct.Prescaler = 399; + TIM_InitStruct.Prescaler = 552; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; TIM_InitStruct.Autoreload = 24; TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; @@ -248,7 +248,7 @@ void MX_TIM17_Init(void) /* USER CODE BEGIN TIM17_Init 1 */ /* USER CODE END TIM17_Init 1 */ - TIM_InitStruct.Prescaler = 399; + TIM_InitStruct.Prescaler = 552; TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; TIM_InitStruct.Autoreload = 999; TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1; diff --git a/MDK-ARM/controller.uvoptx b/MDK-ARM/controller.uvoptx index 882328a..94229a4 100644 --- a/MDK-ARM/controller.uvoptx +++ b/MDK-ARM/controller.uvoptx @@ -1,4 +1,4 @@ - + 1.0 @@ -26,7 +26,7 @@ 0x4 ARM-ADS - 8000000 + 11059000 1 1 @@ -45,7 +45,7 @@ 79 66 8 - + 1 @@ -104,16 +104,16 @@ 0 0 6 - - - - - - - - - - + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll @@ -123,7 +123,7 @@ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476VGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) - + 0 @@ -153,19 +153,19 @@ 0 0 - - + + 0 0 0 - - - - - - - - + + + + + + + + 1 1 @@ -200,7 +200,7 @@ 79 66 8 - + 1 @@ -259,16 +259,16 @@ 0 0 4 - - - - - - - - - - + + + + + + + + + + Segger\JL2CM3.dll @@ -278,7 +278,7 @@ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476VGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) - + 0 @@ -308,19 +308,19 @@ 0 0 - - + + 0 0 0 - - - - - - - - + + + + + + + + 1 1 @@ -355,7 +355,7 @@ 79 66 8 - + 1 @@ -414,16 +414,16 @@ 0 0 6 - - - - - - - - - - + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll @@ -440,7 +440,7 @@ 0 ARMDBGFLAGS - + 0 @@ -458,7 +458,7 @@ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476VGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) - + 0 @@ -500,19 +500,19 @@ 0 0 - - + + 0 0 0 - - - - - - - - + + + + + + + + 1 0 diff --git a/MDK-ARM/controller.uvprojx b/MDK-ARM/controller.uvprojx index b621eed..552b1bb 100644 --- a/MDK-ARM/controller.uvprojx +++ b/MDK-ARM/controller.uvprojx @@ -1,10 +1,7 @@ - - - + + 2.1 -
### uVision Project, (C) Keil Software
- controller @@ -19,28 +16,28 @@ Keil.STM32L4xx_DFP.2.6.2 https://www.keil.com/pack/ IRAM(0x20000000,0x00018000) IRAM2(0x10000000,0x00008000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 DSP CLOCK(12000000) ELITTLE - - + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476RGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) 0 $$Device:STM32L476RGTx$Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h - - - - - - - - - + + + + + + + + + $$Device:STM32L476RGTx$CMSIS\SVD\STM32L4x6.svd 0 0 - + ../Core/Inc;../Drivers/STM32L0xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L0xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/menu;../User/lib/unity;../Tests - - - + + + 0 0 @@ -55,15 +52,15 @@ 1 1 1 - + 1 0 0 0 0 - - + + 0 0 0 @@ -72,8 +69,8 @@ 0 0 - - + + 0 0 0 @@ -90,7 +87,7 @@ 0 1 - + 0 @@ -104,8 +101,8 @@ 0 0 3 - - + + 0 @@ -139,10 +136,10 @@ 1 BIN\UL2CM3.DLL "" () - - - - + + + + 0 @@ -175,7 +172,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -309,7 +306,7 @@ 0x8000 - + 1 @@ -337,8 +334,8 @@ 0 --locale=english --diag_suppress=9 - STM32,SLAVE,USE_FULL_LL_DRIVER,STM32L476xx,__FPU_PRESENT=1U,__FPU_USED=0U,__CC_ARM,ARM_MATH_CM4,HSE_VALUE=8000000,HSE_STARTUP_TIMEOUT=100,LSE_STARTUP_TIMEOUT=5000,LSE_VALUE=32768,EXTERNALSAI1_CLOCK_VALUE=2097000,EXTERNALSAI2_CLOCK_VALUE=2097000,HSI_VALUE=16000000,LSI_VALUE=32000,VDD_VALUE=3300,PREFETCH_ENABLE=1,INSTRUCTION_CACHE_ENABLE=1,DATA_CACHE_ENABLE=1,MSI_VALUE=16000000,PREFETCH_ENABLE=0 - + STM32,SLAVE,USE_FULL_LL_DRIVER,STM32L476xx,__FPU_PRESENT=1U,__FPU_USED=0U,__CC_ARM,ARM_MATH_CM4,HSE_STARTUP_TIMEOUT=100,LSE_STARTUP_TIMEOUT=5000,LSE_VALUE=32768,EXTERNALSAI1_CLOCK_VALUE=2097000,EXTERNALSAI2_CLOCK_VALUE=2097000,HSI_VALUE=16000000,LSI_VALUE=32000,VDD_VALUE=3300,PREFETCH_ENABLE=1,INSTRUCTION_CACHE_ENABLE=1,DATA_CACHE_ENABLE=1,MSI_VALUE=16000000,PREFETCH_ENABLE=0,HSE_VALUE=11059200 + ../Core/Inc;../Drivers/STM32L4xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L4xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/application/mode;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/lcd/gui/Config;../User/lib/lcd/gui/Core;../User/lib/menu;../User/lib/unity;../User/lib/flashdb;../User/lib/flashdb/fal;../User/lib/bootload;../Tests;../Middlewares/ST/ARM/DSP/Inc @@ -354,10 +351,10 @@ 0 4 - - - - + + + + @@ -367,15 +364,15 @@ 0 1 0 - - - + + + .\stm32l476xx.sct - - - - - + + + + +
@@ -495,8 +492,6 @@ 2 2 11 - - 1 @@ -524,12 +519,6 @@ 2 2 2 - - - - - - @@ -816,6 +805,9 @@ + + ::CMSIS + Middlewares/Library/DSP Library/DSP Library @@ -831,8 +823,6 @@ 2 2 11 - - 1 @@ -860,12 +850,6 @@ 2 2 2 - - - - - - 2 @@ -878,16 +862,67 @@ 2 2 1 - - - - - - + + + + 2 + 0 + 0 + 0 + 0 + 1 + 2 + 2 + 2 + 2 + 11 + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + + + + arm_cortexM4l_math.lib 4 @@ -905,18 +940,51 @@ 2 2 11 - - 1 - + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + + - - ::CMSIS - @@ -932,28 +1000,28 @@ Keil.STM32L4xx_DFP.2.6.2 https://www.keil.com/pack/ IRAM(0x20000000,0x00018000) IRAM2(0x10000000,0x00008000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 DSP CLOCK(12000000) ELITTLE - - + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476RGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) 0 $$Device:STM32L476RGTx$Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h - - - - - - - - - + + + + + + + + + $$Device:STM32L476RGTx$CMSIS\SVD\STM32L4x6.svd 0 0 - + ../Core/Inc;../Drivers/STM32L0xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L0xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/menu;../User/lib/unity;../Tests - - - + + + 0 0 @@ -968,15 +1036,15 @@ 1 1 0 - + 1 0 0 0 0 - - + + 0 0 0 @@ -985,8 +1053,8 @@ 0 0 - - + + 0 0 0 @@ -1003,7 +1071,7 @@ 0 1 - + 0 @@ -1017,8 +1085,8 @@ 0 0 3 - - + + 0 @@ -1052,10 +1120,10 @@ 1 BIN\UL2CM3.DLL "" () - - - - + + + + 0 @@ -1088,7 +1156,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -1222,7 +1290,7 @@ 0x8000 - + 1 @@ -1251,7 +1319,7 @@ --locale=english --diag_suppress=9 STM32,SLAVE,USE_FULL_LL_DRIVER,STM32L476xx,__FPU_PRESENT=1U,__FPU_USED=0U,__CC_ARM,ARM_MATH_CM4,HSE_VALUE=8000000,HSE_STARTUP_TIMEOUT=100,LSE_STARTUP_TIMEOUT=5000,LSE_VALUE=32768,EXTERNALSAI1_CLOCK_VALUE=2097000,EXTERNALSAI2_CLOCK_VALUE=2097000,HSI_VALUE=16000000,LSI_VALUE=32000,VDD_VALUE=3300,PREFETCH_ENABLE=1,INSTRUCTION_CACHE_ENABLE=1,DATA_CACHE_ENABLE=1,MSI_VALUE=16000000 - + ../Core/Inc;../Drivers/STM32L4xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L4xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/application/mode;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/lcd/gui/Config;../User/lib/lcd/gui/Core;../User/lib/menu;../User/lib/unity;../User/lib/flashdb;../User/lib/flashdb/fal;../User/lib/bootload;../Tests;../Middlewares/ST/ARM/DSP/Inc @@ -1267,10 +1335,10 @@ 0 4 - - - - + + + + @@ -1280,15 +1348,15 @@ 0 1 0 - - - + + + .\stm32l476xx.sct - - - - - + + + + + @@ -1408,8 +1476,8 @@ 2 2 11 - - + + 1 @@ -1438,10 +1506,10 @@ 2 2 - - - - + + + + @@ -1729,16 +1797,6 @@ - - Middlewares/Library/DSP Library/DSP Library - - - arm_cortexM4l_math.lib - 4 - ../Middlewares/ST/ARM/DSP/Lib/arm_cortexM4l_math.lib - - - ::CMSIS @@ -1754,8 +1812,8 @@ 2 2 11 - - + + 1 @@ -1784,10 +1842,10 @@ 2 2 - - - - + + + + @@ -1802,10 +1860,10 @@ 2 0 - - - - + + + + @@ -1826,28 +1884,28 @@ Keil.STM32L4xx_DFP.2.6.2 https://www.keil.com/pack/ IRAM(0x20000000,0x00018000) IRAM2(0x10000000,0x00008000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 DSP CLOCK(12000000) ELITTLE - - + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0STM32L4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32L476RGTx$CMSIS\Flash\STM32L4xx_1024.FLM)) 0 $$Device:STM32L476RGTx$Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h - - - - - - - - - + + + + + + + + + $$Device:STM32L476RGTx$CMSIS\SVD\STM32L4x6.svd 0 0 - + ../Core/Inc;../Drivers/STM32L0xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L0xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/menu;../User/lib/unity;../Tests - - - + + + 0 0 @@ -1862,15 +1920,15 @@ 1 1 1 - + 1 0 0 0 0 - - + + 0 0 0 @@ -1879,8 +1937,8 @@ 0 0 - - + + 0 0 0 @@ -1897,7 +1955,7 @@ 0 1 - + 0 @@ -1911,8 +1969,8 @@ 0 0 3 - - + + 0 @@ -1946,10 +2004,10 @@ 1 BIN\UL2CM3.DLL "" () - - - - + + + + 0 @@ -1982,7 +2040,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -2116,7 +2174,7 @@ 0x8000 - + 1 @@ -2145,7 +2203,7 @@ --locale=english --diag_suppress=9 STM32,SLAVE,USE_FULL_LL_DRIVER,STM32L476xx,__FPU_PRESENT=1U,__FPU_USED=0U,__CC_ARM,ARM_MATH_CM4,HSE_VALUE=8000000,HSE_STARTUP_TIMEOUT=100,LSE_STARTUP_TIMEOUT=5000,LSE_VALUE=32768,EXTERNALSAI1_CLOCK_VALUE=2097000,EXTERNALSAI2_CLOCK_VALUE=2097000,HSI_VALUE=16000000,LSI_VALUE=32000,VDD_VALUE=3300,PREFETCH_ENABLE=1,INSTRUCTION_CACHE_ENABLE=1,DATA_CACHE_ENABLE=1,MSI_VALUE=16000000 - + ../Core/Inc;../Drivers/STM32L4xx_HAL_Driver/Inc;../Drivers/CMSIS/Device/ST/STM32L4xx/Include;../Drivers/CMSIS/Include;../User;../User/system/bsp;../User/board/inc;../User/lib/inc;../User/system/inc;../User/lib/font;../User/application/inc;../User/application/menus;../User/application/mode;../User/hart/inc;../User/lib/flow;../User/lib/control/inc;../User/lib/control/custom;../User/lib/lcd;../User/lib/lcd/gui/Config;../User/lib/lcd/gui/Core;../User/lib/menu;../User/lib/unity;../User/lib/flashdb;../User/lib/flashdb/fal;../User/lib/bootload;../Tests;../Middlewares/ST/ARM/DSP/Inc @@ -2161,10 +2219,10 @@ 0 4 - - - - + + + + @@ -2174,15 +2232,15 @@ 0 1 0 - - - + + + .\stm32l476xx.sct - - - - - + + + + + @@ -2302,8 +2360,8 @@ 2 2 11 - - + + 1 @@ -2332,10 +2390,10 @@ 2 2 - - - - + + + + @@ -2623,16 +2681,6 @@ - - Middlewares/Library/DSP Library/DSP Library - - - arm_cortexM4l_math.lib - 4 - ../Middlewares/ST/ARM/DSP/Lib/arm_cortexM4l_math.lib - - - ::CMSIS @@ -2648,8 +2696,8 @@ 2 2 11 - - + + 1 @@ -2678,10 +2726,10 @@ 2 2 - - - - + + + + @@ -2696,10 +2744,10 @@ 2 0 - - - - + + + + @@ -2708,21 +2756,19 @@ - - + - + - - + + - + - @@ -2731,5 +2777,5 @@ - + diff --git a/MDK-ARM/controller/controller.axf b/MDK-ARM/controller/controller.axf deleted file mode 100644 index 01bca1e..0000000 Binary files a/MDK-ARM/controller/controller.axf and /dev/null differ diff --git a/User/app.c b/User/app.c index bfc8dee..e38100a 100644 --- a/User/app.c +++ b/User/app.c @@ -428,6 +428,7 @@ void app_init(void) } app_preload_logo(TRUE); + system_clock_config_high(); // 切换高频 // fal初始化 { size = 0; @@ -453,6 +454,7 @@ void app_init(void) fal_execution_status_set(FAL_EXECUTION_EEPROM_M95_2, TRUE); fal_execution_status_set(FAL_EXECUTION_EEPROM_FM24, TRUE); } + system_clock_config_low(); leds_on(LEDS_GREEN); // 断电重启:优先启动控制模块 <=2000ms if (noinit_data.rest_flag == 0) diff --git a/User/app_flow.c b/User/app_flow.c index 2db22a3..253f358 100644 --- a/User/app_flow.c +++ b/User/app_flow.c @@ -503,6 +503,9 @@ static uint8_t business_inspection(struct flow *fl) // 工作模式检测 mode_master_detection(); + // 对外输出电流 + mode_ctrl_output(); + // HART检测 app_hart_inspection(); diff --git a/User/app_hart_user.c b/User/app_hart_user.c index 2d01661..1ede5df 100644 --- a/User/app_hart_user.c +++ b/User/app_hart_user.c @@ -822,7 +822,7 @@ static BOOL hart_write_compression_state_mapping_req(hart_user_req_t *const req) return TRUE; } -// 35-写入电流上下限 +// 35-写入电流上下限(主变量范围) static BOOL hart_write_input_range_req(hart_command_req_t *const req) { float32_u tmp; @@ -948,7 +948,7 @@ BOOL hart_user_handle(hart_interface_user_event_e event, const void *const data) BOOL ret = FALSE; switch (event) { - case HART_COMMAND_35_EVENT: // 写入电流上下限 + case HART_COMMAND_35_EVENT: // 写入电流上下限(主变量范围) ret = hart_write_input_range_req((hart_command_req_t *)data); break; case HART_COMMAND_44_EVENT: // 写入主变量单位 diff --git a/User/application/mode/mode.c b/User/application/mode/mode.c index 7fe2a18..9379c3c 100644 --- a/User/application/mode/mode.c +++ b/User/application/mode/mode.c @@ -361,7 +361,6 @@ void mode_ctrl_gather(void) mode_pressure_statistics(); // 气压轮询读取 } - /** * @brief 控制输出模式函数 * diff --git a/User/application/src/diagnosis.c b/User/application/src/diagnosis.c index 19d1bc1..c2aec1d 100644 --- a/User/application/src/diagnosis.c +++ b/User/application/src/diagnosis.c @@ -1921,7 +1921,8 @@ void power_on_diagnosis(void) { hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_4); } -} + + } /** * @brief 过程诊断 diff --git a/User/application/src/params.c b/User/application/src/params.c index 77d273b..ce0d393 100644 --- a/User/application/src/params.c +++ b/User/application/src/params.c @@ -609,7 +609,7 @@ static void restart_udevice(void) // 定位器软件版本号 udevice.dev_sw_version = SW_VER; // 定位器输出模式 - udevice.dev_algorithm_mode = MODE_FREQUENCY_DOMAIN_CONTROL_ALGORITHM; + udevice.dev_algorithm_mode = MODE_VARIABLE_FREQUENCY_CONTROL_ALGORITHM; // 定位器型号 udevice.dev_model = POSITIONER_MODEL_GPS2000; // 阀门类型:直行程/角行程 TRAVEL_TYPE_STRAIGHT/TRAVEL_TYPE_ANGULAR diff --git a/User/application/src/params_hart.c b/User/application/src/params_hart.c index e8c54cc..7bfd4b2 100644 --- a/User/application/src/params_hart.c +++ b/User/application/src/params_hart.c @@ -23,7 +23,7 @@ static void variable_params_fill_default(hart_device_variable_t *p) p->attribute.alarm_selection_code = ALARM_CODE_NOT_USED; p->attribute.transfer_function_code = TRANSMISSION_FUNCTION_CODE_NOT_USED; p->attribute.analog_channel_flags = ANALOG_CHANNEL_CODE_0; - p->transducer.upper_and_lower_range_values_units_code = p->units_code; + p->attribute.upper_and_lower_range_values_units_code = p->units_code; p->status.bits.process_data_status = DEVICE_VARIABLE_STATUS_MANUAL_FIXED; p->trim_point.trim_points = TRIM_POINTS_1; // HART测试必须所有变量都可测试校准点 p->trim_point.units_code = p->units_code; diff --git a/User/board/inc/board.h b/User/board/inc/board.h index 8e06b60..bf09f56 100644 --- a/User/board/inc/board.h +++ b/User/board/inc/board.h @@ -83,8 +83,6 @@ GPIO_SET(IP_H_PWR_GPIO_Port, IP_H_PWR_Pin); \ } while (0) -///< PWM对外输出 -#define PWM_CTRL_OUTPUT(out) PWM_SET_DUTY(TIM3, 3, out) /* HART */ #define HART_EN_ENABLE() GPIO_SET(HART_PWR_GPIO_Port, HART_PWR_Pin) ///< HART使能 diff --git a/User/entity.h b/User/entity.h index a20e607..d8f38cd 100644 --- a/User/entity.h +++ b/User/entity.h @@ -54,7 +54,7 @@ #define BLE_CURRENT_WORK 7.5f ///< 蓝牙启动工作电流 #define LOOP_TUNE_CURRENT 8.0f ///< 自整定最小输入电流 -#define SYSTEM_CLOCK_HIGHT 16000000U ///< 系统高频运行的时钟 +#define SYSTEM_CLOCK_HIGHT 11059200U ///< 系统高频运行的时钟 #define SYSTEM_HART_CLOCK 460.8f #define TEMP_MIN -40.0f ///< 温度最低-40℃ @@ -684,6 +684,7 @@ typedef struct float32 show_target; float32 show_actual; uint32_t cpuid[3]; ///< CPUID + } real_time_data_t; typedef struct diff --git a/User/hart/hart.c b/User/hart/hart.c index e33bf13..1acb11f 100644 --- a/User/hart/hart.c +++ b/User/hart/hart.c @@ -76,7 +76,8 @@ BOOL hart_init(const hart_init_t *const init) #ifdef SLAVE hart_device_attribute.hart_protocol_version = &handle.hart_protocol_version; - hart_device_attribute.message_count.ack = 0; // 响应消息计数 + hart_device_attribute.message_count.phack = 0; // 响应消息计数 + hart_device_attribute.message_count.shack = 0; // 响应消息计数 if (!DBG_ASSERT((hart_get_current_protocol_version() == HART_PROTOCOL_VERSION_5 || hart_get_current_protocol_version() == HART_PROTOCOL_VERSION_7) __DBG_LINE)) // 校验协议版本号,模块支持协议版本为5,7 return FALSE; @@ -161,7 +162,8 @@ BOOL hart_init(const hart_init_t *const init) handle.interface.set_dynamics(&hart_device_attribute.dynamics); hart_device_attribute.hart_protocol_version = &handle.hart_protocol_version; - hart_device_attribute.message_count.ack = 0; // 响应消息计数 + hart_device_attribute.message_count.phack = 0; // 响应消息计数 + hart_device_attribute.message_count.shack = 0; // 响应消息计数 #else mock_data(); #endif diff --git a/User/hart/hart_frame.c b/User/hart/hart_frame.c index 26abf1b..9d07d37 100644 --- a/User/hart/hart_frame.c +++ b/User/hart/hart_frame.c @@ -49,15 +49,15 @@ void hart_frame_slave_response_operate_code(hart_device_attribute_t *hart_device * Note: Masters will issue this command whenever More Status Available (Bit 4 of the device status byte) issetAs a result, the Field Device must carefully define and contro the events and status information inthis command that affect these two device status bits. f the More Status Available bit is alwaysasserted. then communication bandwidth is effectively cut in half. */ - uint16_t crc = crc16_compute((uint8_t *)&hart_device_attribute->device_status.additional_device_status, sizeof(additional_device_status_t)); - if (hart_device_attribute->device_status.additional_device_status_crc != crc) - { - hart_device_status_set_operational_state(DEVICE_OPERATIONAL_STATE_5); - } - else - { - hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_5); - } +// uint16_t crc = crc16_compute((uint8_t *)&hart_device_attribute->device_status.additional_device_status, sizeof(additional_device_status_t)); +// if (hart_device_attribute->device_status.additional_device_status_crc != crc) +// { +// hart_device_status_set_operational_state(DEVICE_OPERATIONAL_STATE_5); +// } +// else +// { +// hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_5); +// } *(hart_frame_response_code_p + 1) = hart_device_attribute->device_status.operational_state; } diff --git a/User/hart/inc/hart_frame.h b/User/hart/inc/hart_frame.h index f6ac321..60a1a95 100644 --- a/User/hart/inc/hart_frame.h +++ b/User/hart/inc/hart_frame.h @@ -320,7 +320,7 @@ typedef struct typedef struct { uint16_t configuration_change_counter; // 配置被更新的次数 -} hart_command_38_t; // 重置配置更改标志 +} hart_command_38_t; typedef struct { @@ -371,7 +371,10 @@ typedef struct { uint8_t pv_transfer_function_code; } hart_command_47_t; - +typedef struct +{ + uint8_t command48_status[24]; // 配置被更新的次数 +} hart_command_48_t; typedef struct { uint24_t pv_transducer_serial_number; @@ -703,6 +706,7 @@ typedef union hart_command_45_t command_45; // 微调回路电流归零 hart_command_46_t command_46; // 微调回路电流增益 hart_command_47_t command_47; // 编写主变量传递函数 + hart_command_48_t command_48; // 重置配置更改标志 hart_command_49_t command_49; // 写入主变量传感器序列号 hart_command_51_t command_51; // 编写动态变量赋值 hart_command_52_t command_52; // 设置设备变量零 @@ -801,28 +805,31 @@ typedef struct typedef struct { - uint8_t alarm_selection_code; // 报警选择代码 - uint8_t transfer_function_code; // 传递函数代码 - float32 damping_value; // 阻尼值(以秒为单位) + uint8_t alarm_selection_code; // 报警选择代码 + uint8_t transfer_function_code; // 传递函数代码 + uint8_t upper_and_lower_range_values_units_code; // 上限值和下限值单位代码 + float32 damping_value; // 阻尼值(以秒为单位) + float32 upper_range_value; // 上限值 + float32 lower_range_value; // 下限值 uint8_t analog_channel_flags; // 模拟通道标志 analog_channel_code_e } device_attribute_t; // 设备属性 typedef struct { - uint16_t stx; // 此设备接收的STX消息计数 - uint16_t ack; // 从该设备发送的ACK消息计数 - uint16_t back; // 从此设备发送的BACK消息计数 + uint16_t stx; // 此设备接收的STX消息计数 + uint16_t phack; // 从该设备发送到第一主站的ACK消息计数 + uint16_t shack; // 从该设备发送到第二主站的ACK消息计数 + uint16_t back; // 从此设备发送的BACK消息计数 } message_count_t; typedef struct { - uint24_t serial_number; // 传感器序列号 - uint8_t limits_and_minimum_span_units_code; // 传感器限制和最小跨度单位代码 - uint8_t upper_and_lower_range_values_units_code; // 上限值和下限值单位代码 - float32_u upper_limit; // 传感器上限 - float32_u lower_limit; // 传感器下限 - float32_u minimum_span; // 传感器最小跨度 -} transducer_t; // 传感器 + uint24_t serial_number; // 传感器序列号 + uint8_t limits_and_minimum_span_units_code; // 传感器限制和最小跨度单位代码 + float32_u upper_limit; // 传感器上限 + float32_u lower_limit; // 传感器下限 + float32_u minimum_span; // 传感器最小跨度 +} transducer_t; // 传感器 typedef struct { uint8_t trim_points; // 支持的微调点 trim_points_e @@ -1021,6 +1028,14 @@ typedef struct // 这里存放的都是动态变量 } device_variable_dynamics_t; // 设备变量动态,开发人员对该结构体进行初始化 +typedef struct +{ + uint8_t phost_command38; + uint8_t shost_command38; + uint8_t phost_command48; + uint8_t shost_command48; +} simulation_test; // HTS测试使用 add by ZKBW + typedef struct { // 需要实时写入到FLASH中的变量,上电时需要从falsh中读取,在协议中被更新时需要写入到falsh中,地址HART_FLASH_ADDRESS @@ -1045,6 +1060,7 @@ typedef struct // 当前请求来自第一还是第二主机 uint8_t host; + simulation_test simulation; } hart_device_attribute_t; // 设备属性 #pragma pack() diff --git a/User/hart/slave/src/hart_slave.c b/User/hart/slave/src/hart_slave.c index 70f4d0e..e52e0b0 100644 --- a/User/hart/slave/src/hart_slave.c +++ b/User/hart/slave/src/hart_slave.c @@ -532,6 +532,37 @@ BOOL hart_slave_device_send(hart_cache_t *cache_data) handle->response->data_p += cache_data->payload_length; osel_mem_free(cache_data->payload); } + //设备状态位 // ZKBW + if(hart_device_attribute.host == 0x01) + { + if(hart_device_attribute.message_count.phack == 0) + { + hart_device_status_set_operational_state(DEVICE_OPERATIONAL_STATE_6); + } + else if(hart_device_attribute.simulation.phost_command48 == 0) + { + BIT_CLR(hart_device_attribute.device_status.operational_state, DEVICE_OPERATIONAL_STATE_5); + } + else if(hart_device_attribute.simulation.phost_command48 == 1) + { + BIT_SET(hart_device_attribute.device_status.operational_state, DEVICE_OPERATIONAL_STATE_5); + } + } + else if(hart_device_attribute.host == 0x00) + { + if(hart_device_attribute.message_count.shack == 0) + { + hart_device_status_set_operational_state(DEVICE_OPERATIONAL_STATE_6); + } + else if(hart_device_attribute.simulation.shost_command48 == 0) + { + BIT_CLR(hart_device_attribute.device_status.operational_state, DEVICE_OPERATIONAL_STATE_5); + } + else if(hart_device_attribute.simulation.shost_command48 == 1) + { + BIT_SET(hart_device_attribute.device_status.operational_state, DEVICE_OPERATIONAL_STATE_5); + } + } hart_frame_data_length_end(handle->response->data_p); hart_frame_response_communication_code(cache_data->code); @@ -552,12 +583,24 @@ BOOL hart_slave_device_send(hart_cache_t *cache_data) if (handle->response->data_length > 0) { + handle->response_call(cache_data->uart_index, handle->response->data, handle->response->data_length); - hart_device_attribute.message_count.ack++; - - // 发送完第一帧后,需要清理设备状态 + if(hart_device_attribute.host == 0x01) { - if (hart_device_attribute.message_count.ack == 1) + hart_device_attribute.message_count.phack++; + } + if(hart_device_attribute.host == 0x00) + { + hart_device_attribute.message_count.shack++; + } + + // 发送完第一帧后,需要清理设备冷启动状态 // ZKBW + { + if (hart_device_attribute.message_count.phack == 1 && hart_device_attribute.host == 0x01) + { + hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_6); + } + if (hart_device_attribute.message_count.shack == 1 && hart_device_attribute.host == 0x00) { hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_6); } diff --git a/User/hart/slave/src/hart_slave_frame.c b/User/hart/slave/src/hart_slave_frame.c index 58625fc..cc9d28d 100644 --- a/User/hart/slave/src/hart_slave_frame.c +++ b/User/hart/slave/src/hart_slave_frame.c @@ -37,6 +37,7 @@ static void hart_configuration_count_update(void) } else { + //hart_device_attribute.flash_variable.master_cfg_update_count++; hart_device_attribute.flash_variable.slave_cfg_update_count++; hart_storage_write_item(HART_STORAGE_PARAMS, HPB_SLAVE_CFG_UPDATE_COUNT, (uint8_t *)&hart_device_attribute.flash_variable.slave_cfg_update_count); diff --git a/User/hart/slave/src/hart_slave_req.c b/User/hart/slave/src/hart_slave_req.c index bc6fc1e..61c1e76 100644 --- a/User/hart/slave/src/hart_slave_req.c +++ b/User/hart/slave/src/hart_slave_req.c @@ -31,7 +31,7 @@ static void command_0_req(const hart_command_req_t *const req, hart_response_t * resp->data_p++; // 保留 osel_memcpy(resp->data_p, hart_device_attribute.flash_variable.long_address + 2, 3); // 设备ID,长ID的后3个字节 resp->data_p += 3; - uint16_t cfg_cnt = req->master == HART_MASTER ? hart_device_attribute.flash_variable.master_cfg_update_count : hart_device_attribute.flash_variable.slave_cfg_update_count; // 配置更新计数 + uint16_t cfg_cnt = hart_device_attribute.flash_variable.master_cfg_update_count; // ZKBW req->master == HART_MASTER ? hart_device_attribute.flash_variable.master_cfg_update_count : hart_device_attribute.flash_variable.slave_cfg_update_count; // 配置更新计数 if (hart_get_current_protocol_version() == HART_PROTOCOL_VERSION_7) { *resp->data_p++ = hart_device_attribute.flash_variable.s2m_preambles; // 从设备到主设备的响应前导码个数 @@ -242,6 +242,14 @@ static BOOL hart_slave_command_6_req(const hart_command_req_t *const req, hart_r } else { + if (req->data.command_6.poll_address != hart_device_attribute.flash_variable.poll_address) + { + hart_device_attribute.flash_variable.poll_address = req->data.command_6.poll_address; + hart_storage_write_item(HART_STORAGE_PARAMS, HPB_POLL_ADDRESS, + &hart_device_attribute.flash_variable.poll_address); + change = TRUE; + } + if (req->data.command_6.loop_current_mode != hart_device_attribute.flash_variable.loop_current_mode) { hart_device_attribute.flash_variable.loop_current_mode = req->data.command_6.loop_current_mode; @@ -522,10 +530,10 @@ static BOOL hart_slave_command_15_req(const hart_command_req_t *const req, hart_ data.pv_alarm_selection_code = variable->attribute.alarm_selection_code; data.pv_transfer_function_code = variable->attribute.transfer_function_code; - data.pv_upper_and_lower_range_values_units_code = variable->transducer.upper_and_lower_range_values_units_code; + data.pv_upper_and_lower_range_values_units_code = variable->attribute.upper_and_lower_range_values_units_code; data.pv_damping_value.f = variable->attribute.damping_value; - osel_memcpy((uint8_t *)&data.pv_upper_range_value.f, (uint8_t *)&variable->transducer.upper_limit.f, sizeof(float32)); - osel_memcpy((uint8_t *)&data.pv_lower_range_value.f, (uint8_t *)&variable->transducer.lower_limit.f, sizeof(float32)); + osel_memcpy((uint8_t *)&data.pv_upper_range_value.f, (uint8_t *)&variable->attribute.upper_range_value, sizeof(float32)); + osel_memcpy((uint8_t *)&data.pv_lower_range_value.f, (uint8_t *)&variable->attribute.lower_range_value, sizeof(float32)); data.pv_upper_range_value.c = S2B_UINT32(data.pv_upper_range_value.c); // 主变量上限 data.pv_lower_range_value.c = S2B_UINT32(data.pv_lower_range_value.c); // 主变量下限 data.pv_damping_value.c = S2B_UINT32(data.pv_damping_value.c); // 主变量阻尼 @@ -731,7 +739,7 @@ static BOOL hart_slave_command_21_req(const hart_command_req_t *const req, hart_ } else { - resp->code = RESPONSE_COMMUNICATION_CODE_38; + return FALSE; } return TRUE; } @@ -775,9 +783,12 @@ static BOOL hart_slave_command_22_req(const hart_command_req_t *const req, hart_ */ static BOOL hart_slave_command_38_req(const hart_command_req_t *const req, hart_response_t *resp) // ZKBW { - uint16_t cfg_cnt = req->master == HART_MASTER ? hart_device_attribute.flash_variable.master_cfg_update_count : hart_device_attribute.flash_variable.slave_cfg_update_count; // 配置更新计数 + uint16_t cfg_cnt = hart_device_attribute.flash_variable.master_cfg_update_count; // req->master == HART_MASTER ? hart_device_attribute.flash_variable.master_cfg_update_count : hart_device_attribute.flash_variable.slave_cfg_update_count; // 配置更新计数 - if (req->data_length == 1) // ZKBW + if (req->data_length == 0) + { + } + else if (req->data_length == 1) // ZKBW { resp->code = RESPONSE_COMMUNICATION_CODE_5; return TRUE; @@ -801,7 +812,11 @@ static BOOL hart_slave_command_38_req(const hart_command_req_t *const req, hart_ { *resp->data_p++ = HI_UINT16(cfg_cnt); *resp->data_p++ = LO_UINT16(cfg_cnt); - hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_7); + if (hart_device_attribute.host == 0x01) + { + BIT_CLR(hart_device_attribute.device_status.operational_state, DEVICE_OPERATIONAL_STATE_7); + } + // hart_device_status_clr_operational_state(DEVICE_OPERATIONAL_STATE_7); } return TRUE; } @@ -815,8 +830,38 @@ static BOOL hart_slave_command_38_req(const hart_command_req_t *const req, hart_ static BOOL hart_slave_command_48_req(const hart_command_req_t *const req, hart_response_t *resp) { additional_device_status_t command_48; + uint8_t *ptr = NULL; osel_memset((uint8_t *)&command_48, 0x00, sizeof(additional_device_status_t)); + if (req->data_length == 0) + { + } + else if (req->data_length > 0 & req->data_length < 10) + { + resp->code = RESPONSE_COMMUNICATION_CODE_5; + return TRUE; + } + else + { + if ((req->data.command_48.command48_status[0] == hart_device_attribute.device_status.additional_device_status.device_specific_status[0]) && (req->data.command_48.command48_status[1] == hart_device_attribute.device_status.additional_device_status.device_specific_status[1]) && (req->data.command_48.command48_status[2] == hart_device_attribute.device_status.additional_device_status.device_specific_status[2]) && (req->data.command_48.command48_status[3] == hart_device_attribute.device_status.additional_device_status.device_specific_status[3]) && (req->data.command_48.command48_status[4] == hart_device_attribute.device_status.additional_device_status.device_specific_status[4]) && (req->data.command_48.command48_status[5] == hart_device_attribute.device_status.additional_device_status.device_specific_status[5]) && (req->data.command_48.command48_status[6] == hart_device_attribute.device_status.additional_device_status.extended_device_status) && (req->data.command_48.command48_status[7] == hart_device_attribute.device_status.additional_device_status.device_operating_mode) && (req->data.command_48.command48_status[8] == hart_device_attribute.device_status.additional_device_status.standardized_status0) && (req->data.command_48.command48_status[9] == hart_device_attribute.device_status.additional_device_status.standardized_status1)) + { + if (hart_device_attribute.host == 0x01) + { + // 清第一主站更多状态 + hart_device_attribute.simulation.phost_command48 = 0; + } + if (hart_device_attribute.host == 0x00) + { + // 清第二主站更多状态 + hart_device_attribute.simulation.shost_command48 = 0; + } + } + else + { + resp->code = RESPONSE_COMMUNICATION_CODE_14; + // return TRUE; + } + } ptr = command_48.device_specific_status; for (uint8_t i = 0; i < ARRAY_LEN(hart_device_attribute.device_status.additional_device_status.device_specific_status); i++) { @@ -833,20 +878,20 @@ static BOOL hart_slave_command_48_req(const hart_command_req_t *const req, hart_ ptr++; *ptr = hart_device_attribute.device_status.additional_device_status.standardized_status1; ptr++; - // *ptr = hart_device_attribute.device_status.additional_device_status.analog_channel_saturated; - // ptr++; - // *ptr = hart_device_attribute.device_status.additional_device_status.standardized_status2; - // ptr++; - // *ptr = hart_device_attribute.device_status.additional_device_status.standardized_status3; - // ptr++; - // *ptr = hart_device_attribute.device_status.additional_device_status.analog_channel_fixed; - // ptr++; + // *ptr = hart_device_attribute.device_status.additional_device_status.analog_channel_saturated; + // ptr++; + // *ptr = hart_device_attribute.device_status.additional_device_status.standardized_status2; + // ptr++; + // *ptr = hart_device_attribute.device_status.additional_device_status.standardized_status3; + // ptr++; + // *ptr = hart_device_attribute.device_status.additional_device_status.analog_channel_fixed; + // ptr++; - // ptr = command_48.extended_device_specific_status; - // for (uint8_t i = 0; i < 11; i++) - // { - // *ptr = hart_device_attribute.device_status.additional_device_status.extended_device_specific_status[i]; - // } + // ptr = command_48.extended_device_specific_status; + // for (uint8_t i = 0; i < 11; i++) + // { + // *ptr = hart_device_attribute.device_status.additional_device_status.extended_device_specific_status[i]; + // } // 回复数据 osel_memcpy(resp->data_p, (uint8_t *)&command_48, sizeof(additional_device_status_t)); @@ -878,7 +923,7 @@ static BOOL hart_slave_command_31_req(const hart_command_req_t *const req, hart_ * @param {hart_response_t} *resp * @return {*} */ -static BOOL hart_slave_command_33_req(const hart_command_req_t *const req, hart_response_t *resp) // ZKBW +static BOOL hart_slave_command_33_req(const hart_command_req_t *const req, hart_response_t *resp) // ZKBW { uint8_t *code = NULL; hart_device_variable_t *variable = NULL; @@ -891,12 +936,15 @@ static BOOL hart_slave_command_33_req(const hart_command_req_t *const req, hart_ resp->code = RESPONSE_COMMUNICATION_CODE_5; return TRUE; } - if(uctemp_length > 4) + if (uctemp_length > 4) { uctemp_length = 4; } - if(uctemp_length == 4 && req->data.command_33.slot_0 == 0xff && req->data.command_33.slot_1 == 0xff - && req->data.command_33.slot_2 == 0xff && req->data.command_33.slot_3) + if (uctemp_length == 4 && + req->data.command_33.slot_0 == 0xff && + req->data.command_33.slot_1 == 0xff && + req->data.command_33.slot_2 == 0xff && + req->data.command_33.slot_3) { resp->code = RESPONSE_COMMUNICATION_CODE_2; return TRUE; @@ -905,7 +953,7 @@ static BOOL hart_slave_command_33_req(const hart_command_req_t *const req, hart_ code = (uint8_t *)&req->data.command_33; for (uint8_t i = 0; i < uctemp_length; i++) { - + type = get_variable_type(*code); if (type == VARIABLE) { @@ -962,9 +1010,9 @@ static BOOL hart_slave_command_35_req(const hart_command_req_t *const req, hart_ { if (variable->units_code_allow[i] == req->data.command_35.pv_upper_and_lower_range_values_units_code) { - if (variable->transducer.upper_and_lower_range_values_units_code != req->data.command_35.pv_upper_and_lower_range_values_units_code) + if (variable->attribute.upper_and_lower_range_values_units_code != req->data.command_35.pv_upper_and_lower_range_values_units_code) { - variable->transducer.upper_and_lower_range_values_units_code = req->data.command_35.pv_upper_and_lower_range_values_units_code; + variable->attribute.upper_and_lower_range_values_units_code = req->data.command_35.pv_upper_and_lower_range_values_units_code; change = TRUE; } break; @@ -979,32 +1027,32 @@ static BOOL hart_slave_command_35_req(const hart_command_req_t *const req, hart_ tmpupper.c = B2S_UINT32(tmpupper.c); tmplower.f = req->data.command_35.pv_lower_range_value; tmplower.c = B2S_UINT32(tmplower.c); - if ((tmpupper.f > variable->transducer.upper_limit.f && tmplower.f < variable->transducer.lower_limit.f) || (tmpupper.f < variable->transducer.lower_limit.f && tmplower.f > variable->transducer.upper_limit.f)) + if ((tmpupper.f > variable->attribute.upper_range_value && tmplower.f < variable->attribute.lower_range_value) || (tmpupper.f < variable->attribute.lower_range_value && tmplower.f > variable->attribute.lower_range_value)) { resp->code = RESPONSE_COMMUNICATION_CODE_13; return TRUE; } - if (tmplower.f > variable->transducer.upper_limit.f) + if (tmplower.f > variable->attribute.lower_range_value) { resp->code = RESPONSE_COMMUNICATION_CODE_9; return TRUE; } - if (tmpupper.f > variable->transducer.upper_limit.f) + if (tmpupper.f > variable->attribute.lower_range_value) { resp->code = RESPONSE_COMMUNICATION_CODE_11; return TRUE; } - if (tmpupper.f < variable->transducer.lower_limit.f) + if (tmpupper.f < variable->attribute.lower_range_value) { resp->code = RESPONSE_COMMUNICATION_CODE_12; return TRUE; } - if (tmplower.f < variable->transducer.lower_limit.f) + if (tmplower.f < variable->attribute.lower_range_value) { resp->code = RESPONSE_COMMUNICATION_CODE_10; @@ -1027,15 +1075,15 @@ static BOOL hart_slave_command_35_req(const hart_command_req_t *const req, hart_ resp->code = RESPONSE_COMMUNICATION_CODE_14; } - if (variable->transducer.upper_limit.f != tmpupper.f) + if (variable->attribute.lower_range_value != tmpupper.f) { - osel_memcpy((uint8_t *)&variable->transducer.upper_limit.f, (uint8_t *)&tmpupper.f, sizeof(float32)); + osel_memcpy((uint8_t *)&variable->attribute.lower_range_value, (uint8_t *)&tmpupper.f, sizeof(float32)); change = TRUE; } - if (variable->transducer.lower_limit.f != tmplower.f) + if (variable->attribute.lower_range_value != tmplower.f) { - osel_memcpy((uint8_t *)&variable->transducer.lower_limit.f, (uint8_t *)&tmplower.f, sizeof(float32)); + osel_memcpy((uint8_t *)&variable->attribute.lower_range_value, (uint8_t *)&tmplower.f, sizeof(float32)); change = TRUE; } @@ -1044,13 +1092,13 @@ static BOOL hart_slave_command_35_req(const hart_command_req_t *const req, hart_ hart_device_status_set_operational_state(DEVICE_OPERATIONAL_STATE_7); } // 回复数据 - *resp->data_p++ = variable->transducer.upper_and_lower_range_values_units_code; - osel_memcpy((uint8_t *)&tmpupper.f, (uint8_t *)&variable->transducer.upper_limit.f, sizeof(float32)); + *resp->data_p++ = variable->attribute.upper_and_lower_range_values_units_code; + osel_memcpy((uint8_t *)&tmpupper.f, (uint8_t *)&variable->attribute.lower_range_value, sizeof(float32)); tmpupper.c = S2B_UINT32(tmpupper.c); osel_memcpy(resp->data_p, (uint8_t *)&tmpupper, sizeof(float32_u)); resp->data_p += sizeof(float32_u); - osel_memcpy((uint8_t *)&tmplower.f, (uint8_t *)&variable->transducer.lower_limit.f, sizeof(float32)); + osel_memcpy((uint8_t *)&tmplower.f, (uint8_t *)&variable->attribute.lower_range_value, sizeof(float32)); tmplower.c = S2B_UINT32(tmplower.c); osel_memcpy(resp->data_p, (uint8_t *)&tmplower, sizeof(float32_u)); resp->data_p += sizeof(float32_u); @@ -1110,9 +1158,9 @@ static BOOL hart_slave_command_44_req(const hart_command_req_t *const req, hart_ variable->units_code = req->data.command_44.pv_units_code; change = TRUE; } - if (variable->transducer.upper_and_lower_range_values_units_code != req->data.command_44.pv_units_code) + if (variable->attribute.upper_and_lower_range_values_units_code != req->data.command_44.pv_units_code) { - variable->transducer.upper_and_lower_range_values_units_code = req->data.command_44.pv_units_code; + variable->attribute.upper_and_lower_range_values_units_code = req->data.command_44.pv_units_code; change = TRUE; } break; @@ -1172,8 +1220,8 @@ static BOOL hart_slave_command_51_req(const hart_command_req_t *const req, hart_ BOOL change = FALSE; uint8_t *ptr = NULL; uint8_t code = 0; -// uint16_t invalid_selection[] = {DIN_244, DIN_245, DIN_246, DIN_247, -// DIN_248, DIN_249}; + // uint16_t invalid_selection[] = {DIN_244, DIN_245, DIN_246, DIN_247, + // DIN_248, DIN_249}; uint8_t device_variables[4]; osel_memset(device_variables, DIN_250, ARRAY_LEN(device_variables)); for (uint8_t i = 0; i < req->data_length; i++) @@ -1294,8 +1342,7 @@ static BOOL hart_slave_command_53_req(const hart_command_req_t *const req, hart_ } osel_memcpy((uint8_t *)&user_req.data.command_53, (uint8_t *)&req->data.command_53, sizeof(hart_command_53_t)); hart_device_variable_p = get_device_variable(req->data.command_53.device_ariable); - - + type = get_variable_type(req->data.command_53.device_ariable); if (type == VARIABLE) { @@ -1309,7 +1356,7 @@ static BOOL hart_slave_command_53_req(const hart_command_req_t *const req, hart_ { hart_device_variable_p = get_device_variable_by_standard_code(req->data.command_53.device_ariable); } - if(req->data.command_53.device_ariable_unit_code == 0xFA) + if (req->data.command_53.device_ariable_unit_code == 0xFA) { resp->code = RESPONSE_COMMUNICATION_CODE_12; return TRUE; diff --git a/User/static.lib b/User/static.lib index 1a49b4b..43742a5 100644 Binary files a/User/static.lib and b/User/static.lib differ diff --git a/controller.ioc b/controller.ioc index 5f4bb51..b1958b8 100644 --- a/controller.ioc +++ b/controller.ioc @@ -554,60 +554,65 @@ ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=false ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_DMA_Init-DMA-false-LL-true,4-MX_ADC1_Init-ADC1-false-LL-true,5-MX_TIM3_Init-TIM3-false-LL-true,6-MX_DAC1_Init-DAC1-false-LL-true,7-MX_SPI2_Init-SPI2-false-LL-true,8-MX_SPI1_Init-SPI1-false-LL-true,9-MX_TIM2_Init-TIM2-false-LL-true,10-MX_UART5_Init-UART5-false-LL-true,11-MX_USART1_UART_Init-USART1-false-LL-true,12-MX_TIM6_Init-TIM6-false-LL-true,13-MX_TIM7_Init-TIM7-false-LL-true,14-MX_TIM17_Init-TIM17-false-LL-true,15-MX_TIM16_Init-TIM16-false-LL-true -RCC.ADCFreq_Value=32000000 -RCC.AHBCLKDivider=RCC_SYSCLK_DIV8 -RCC.AHBFreq_Value=4000000 -RCC.APB1Freq_Value=4000000 -RCC.APB1TimFreq_Value=4000000 -RCC.APB2Freq_Value=4000000 -RCC.APB2TimFreq_Value=4000000 -RCC.CortexFreq_Value=4000000 -RCC.DFSDMFreq_Value=4000000 -RCC.FCLKCortexFreq_Value=4000000 +RCC.ADCFreq_Value=8294400 +RCC.AHBCLKDivider=RCC_SYSCLK_DIV2 +RCC.AHBFreq_Value=5529600 +RCC.APB1Freq_Value=5529600 +RCC.APB1TimFreq_Value=5529600 +RCC.APB2Freq_Value=5529600 +RCC.APB2TimFreq_Value=5529600 +RCC.CortexFreq_Value=5529600 +RCC.DFSDMFreq_Value=5529600 +RCC.FCLKCortexFreq_Value=5529600 RCC.FamilyName=M -RCC.HCLKFreq_Value=4000000 -RCC.HSE_VALUE=8000000 +RCC.HCLKFreq_Value=5529600 +RCC.HSE_VALUE=11059200 RCC.HSI_VALUE=16000000 -RCC.I2C1Freq_Value=4000000 -RCC.I2C2Freq_Value=4000000 -RCC.I2C3Freq_Value=4000000 -RCC.IPParameters=ADCFreq_Value,AHBCLKDivider,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,DFSDMFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MSIClockRange,MSI_VALUE,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSAI1PoutputFreq_Value,PLLSAI1QoutputFreq_Value,PLLSAI1RoutputFreq_Value,PLLSAI2PoutputFreq_Value,PLLSAI2RoutputFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value,VCOSAI2OutputFreq_Value -RCC.LPTIM1Freq_Value=4000000 -RCC.LPTIM2Freq_Value=4000000 -RCC.LPUART1Freq_Value=4000000 +RCC.I2C1Freq_Value=5529600 +RCC.I2C2Freq_Value=5529600 +RCC.I2C3Freq_Value=5529600 +RCC.IPParameters=ADCFreq_Value,AHBCLKDivider,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,DFSDMFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MSIClockRange,MSI_VALUE,PLLM,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLR,PLLRCLKFreq_Value,PLLSAI1N,PLLSAI1PoutputFreq_Value,PLLSAI1QoutputFreq_Value,PLLSAI1R,PLLSAI1RoutputFreq_Value,PLLSAI2PoutputFreq_Value,PLLSAI2RoutputFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value,VCOSAI2OutputFreq_Value +RCC.LPTIM1Freq_Value=5529600 +RCC.LPTIM2Freq_Value=5529600 +RCC.LPUART1Freq_Value=5529600 RCC.LSCOPinFreq_Value=32000 RCC.LSE_VALUE=32768 RCC.LSI_VALUE=32000 -RCC.MCO1PinFreq_Value=32000000 +RCC.MCO1PinFreq_Value=11059200 RCC.MSIClockRange=RCC_MSIRANGE_8 RCC.MSI_VALUE=16000000 -RCC.PLLPoutputFreq_Value=9142857.142857144 -RCC.PLLQoutputFreq_Value=32000000 -RCC.PLLRCLKFreq_Value=32000000 -RCC.PLLSAI1PoutputFreq_Value=9142857.142857144 -RCC.PLLSAI1QoutputFreq_Value=32000000 -RCC.PLLSAI1RoutputFreq_Value=32000000 -RCC.PLLSAI2PoutputFreq_Value=9142857.142857144 -RCC.PLLSAI2RoutputFreq_Value=32000000 +RCC.PLLM=2 +RCC.PLLN=12 +RCC.PLLPoutputFreq_Value=9479314.285714285 +RCC.PLLQoutputFreq_Value=33177600 +RCC.PLLR=RCC_PLLR_DIV6 +RCC.PLLRCLKFreq_Value=11059200 +RCC.PLLSAI1N=12 +RCC.PLLSAI1PoutputFreq_Value=9479314.285714285 +RCC.PLLSAI1QoutputFreq_Value=33177600 +RCC.PLLSAI1R=RCC_PLLR_DIV8 +RCC.PLLSAI1RoutputFreq_Value=8294400 +RCC.PLLSAI2PoutputFreq_Value=6319542.857142857 +RCC.PLLSAI2RoutputFreq_Value=22118400 RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE -RCC.PWRFreq_Value=32000000 -RCC.RNGFreq_Value=32000000 -RCC.SAI1Freq_Value=9142857.142857144 -RCC.SAI2Freq_Value=9142857.142857144 -RCC.SDMMCFreq_Value=32000000 -RCC.SWPMI1Freq_Value=4000000 -RCC.SYSCLKFreq_VALUE=32000000 +RCC.PWRFreq_Value=11059200 +RCC.RNGFreq_Value=33177600 +RCC.SAI1Freq_Value=9479314.285714285 +RCC.SAI2Freq_Value=9479314.285714285 +RCC.SDMMCFreq_Value=33177600 +RCC.SWPMI1Freq_Value=5529600 +RCC.SYSCLKFreq_VALUE=11059200 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK -RCC.UART4Freq_Value=4000000 -RCC.UART5Freq_Value=4000000 -RCC.USART1Freq_Value=4000000 -RCC.USART2Freq_Value=4000000 -RCC.USART3Freq_Value=4000000 -RCC.USBFreq_Value=32000000 -RCC.VCOInputFreq_Value=8000000 -RCC.VCOOutputFreq_Value=64000000 -RCC.VCOSAI1OutputFreq_Value=64000000 -RCC.VCOSAI2OutputFreq_Value=64000000 +RCC.UART4Freq_Value=5529600 +RCC.UART5Freq_Value=5529600 +RCC.USART1Freq_Value=5529600 +RCC.USART2Freq_Value=5529600 +RCC.USART3Freq_Value=5529600 +RCC.USBFreq_Value=33177600 +RCC.VCOInputFreq_Value=5529600 +RCC.VCOOutputFreq_Value=66355200 +RCC.VCOSAI1OutputFreq_Value=66355200 +RCC.VCOSAI2OutputFreq_Value=44236800 SH.ADCx_IN11.0=ADC1_IN11,IN11-Single-Ended SH.ADCx_IN11.ConfNb=1 SH.ADCx_IN12.0=ADC1_IN12,IN12-Single-Ended @@ -639,7 +644,7 @@ SH.S_TIM3_CH2.ConfNb=1 SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2 SPI1.CLKPhase=SPI_PHASE_2EDGE SPI1.CLKPolarity=SPI_POLARITY_HIGH -SPI1.CalculateBaudRate=2.0 MBits/s +SPI1.CalculateBaudRate=2.7648 MBits/s SPI1.DataSize=SPI_DATASIZE_8BIT SPI1.Direction=SPI_DIRECTION_2LINES SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,CLKPolarity,CLKPhase,BaudRatePrescaler @@ -647,7 +652,7 @@ SPI1.Mode=SPI_MODE_MASTER SPI1.VirtualType=VM_MASTER SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_4 SPI2.CLKPolarity=SPI_POLARITY_LOW -SPI2.CalculateBaudRate=1000.0 KBits/s +SPI2.CalculateBaudRate=1.3824 MBits/s SPI2.DataSize=SPI_DATASIZE_8BIT SPI2.Direction=SPI_DIRECTION_2LINES SPI2.FirstBit=SPI_FIRSTBIT_LSB @@ -662,11 +667,11 @@ STMicroelectronics.X-CUBE-ALGOBUILD.1.3.0_SwParameter=LibraryCcDSPOoLibraryJjDSP TIM16.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM16.IPParameters=Prescaler,Period,AutoReloadPreload TIM16.Period=24 -TIM16.Prescaler=399 +TIM16.Prescaler=552 TIM17.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM17.IPParameters=Prescaler,Period,AutoReloadPreload TIM17.Period=999 -TIM17.Prescaler=399 +TIM17.Prescaler=552 TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM2.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM2.ClearChannel4=TIM_CHANNEL_4 @@ -675,22 +680,22 @@ TIM2.CounterMode=TIM_COUNTERMODE_UP TIM2.IPParameters=Channel-PWM Generation4 CH4,Period,AutoReloadPreload,ClearInputSource,ClearChannel4,Prescaler,OCPolarity_4,CounterMode,OCFastMode_PWM-PWM Generation4 CH4 TIM2.OCFastMode_PWM-PWM\ Generation4\ CH4=TIM_OCFAST_ENABLE TIM2.OCPolarity_4=TIM_OCPOLARITY_HIGH -TIM2.Period=3999 +TIM2.Period=5529 TIM2.Prescaler=0 TIM3.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM3.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2 TIM3.IPParameters=Period,AutoReloadPreload,Prescaler,Channel-PWM Generation2 CH2,Pulse-PWM Generation2 CH2 -TIM3.Period=3999 +TIM3.Period=11 TIM3.Prescaler=0 TIM3.Pulse-PWM\ Generation2\ CH2=0 TIM6.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM6.IPParameters=Prescaler,Period,AutoReloadPreload TIM6.Period=99 -TIM6.Prescaler=399 +TIM6.Prescaler=552 TIM7.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM7.IPParameters=Prescaler,Period,AutoReloadPreload TIM7.Period=249 -TIM7.Prescaler=399 +TIM7.Prescaler=552 UART5.BaudRate=115200 UART5.IPParameters=BaudRate USART1.BaudRate=1200