From 61b831356501c2804757917868b6371b84fa7a52 Mon Sep 17 00:00:00 2001 From: tianjialong Date: Wed, 1 Mar 2023 15:04:50 +0800 Subject: [PATCH] =?UTF-8?q?cubemx=E9=85=8D=E7=BD=AE=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E4=B8=AA=E7=BC=96=E7=A0=81=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inc/tim.h | 3 + LWIP.ioc | 45 ++- MDK-ARM/LWIP.uvoptx | 46 +-- MDK-ARM/LWIP.uvprojx | 1088 +++----------------------------------------------- Src/freertos.c | 3 +- Src/main.c | 1 + Src/tim.c | 88 ++++ 7 files changed, 201 insertions(+), 1073 deletions(-) diff --git a/Inc/tim.h b/Inc/tim.h index b2a6e9b..5c33b14 100644 --- a/Inc/tim.h +++ b/Inc/tim.h @@ -36,12 +36,15 @@ extern TIM_HandleTypeDef htim4; extern TIM_HandleTypeDef htim6; +extern TIM_HandleTypeDef htim8; + /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ void MX_TIM4_Init(void); void MX_TIM6_Init(void); +void MX_TIM8_Init(void); /* USER CODE BEGIN Prototypes */ diff --git a/LWIP.ioc b/LWIP.ioc index 4bdacb5..0ca3796 100644 --- a/LWIP.ioc +++ b/LWIP.ioc @@ -45,26 +45,29 @@ Mcu.IP4=RCC Mcu.IP5=SYS Mcu.IP6=TIM4 Mcu.IP7=TIM6 -Mcu.IP8=USART1 -Mcu.IPNb=9 +Mcu.IP8=TIM8 +Mcu.IP9=USART1 +Mcu.IPNb=10 Mcu.Name=STM32F407Z(E-G)Tx Mcu.Package=LQFP144 Mcu.Pin0=PF10 Mcu.Pin1=PH0-OSC_IN Mcu.Pin10=PD13 -Mcu.Pin11=PA9 -Mcu.Pin12=PA10 -Mcu.Pin13=PA13 -Mcu.Pin14=PA14 -Mcu.Pin15=PD3 -Mcu.Pin16=PG11 -Mcu.Pin17=PG13 -Mcu.Pin18=PG14 -Mcu.Pin19=VP_FREERTOS_VS_CMSIS_V1 +Mcu.Pin11=PC6 +Mcu.Pin12=PC7 +Mcu.Pin13=PA9 +Mcu.Pin14=PA10 +Mcu.Pin15=PA13 +Mcu.Pin16=PA14 +Mcu.Pin17=PD3 +Mcu.Pin18=PG11 +Mcu.Pin19=PG13 Mcu.Pin2=PH1-OSC_OUT -Mcu.Pin20=VP_LWIP_VS_Enabled -Mcu.Pin21=VP_SYS_VS_tim1 -Mcu.Pin22=VP_TIM6_VS_ClockSourceINT +Mcu.Pin20=PG14 +Mcu.Pin21=VP_FREERTOS_VS_CMSIS_V1 +Mcu.Pin22=VP_LWIP_VS_Enabled +Mcu.Pin23=VP_SYS_VS_tim1 +Mcu.Pin24=VP_TIM6_VS_ClockSourceINT Mcu.Pin3=PC1 Mcu.Pin4=PA1 Mcu.Pin5=PA2 @@ -72,7 +75,7 @@ Mcu.Pin6=PA7 Mcu.Pin7=PC4 Mcu.Pin8=PC5 Mcu.Pin9=PD12 -Mcu.PinsNb=23 +Mcu.PinsNb=25 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F407ZETx @@ -117,6 +120,12 @@ PC4.Mode=RMII PC4.Signal=ETH_RXD0 PC5.Mode=RMII PC5.Signal=ETH_RXD1 +PC6.GPIOParameters=GPIO_PuPd +PC6.GPIO_PuPd=GPIO_PULLUP +PC6.Signal=S_TIM8_CH1 +PC7.GPIOParameters=GPIO_PuPd +PC7.GPIO_PuPd=GPIO_PULLUP +PC7.Signal=S_TIM8_CH2 PD12.GPIOParameters=GPIO_PuPd PD12.GPIO_PuPd=GPIO_PULLUP PD12.Signal=S_TIM4_CH1 @@ -209,12 +218,18 @@ SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface SH.S_TIM4_CH1.ConfNb=1 SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface SH.S_TIM4_CH2.ConfNb=1 +SH.S_TIM8_CH1.0=TIM8_CH1,Encoder_Interface +SH.S_TIM8_CH1.ConfNb=1 +SH.S_TIM8_CH2.0=TIM8_CH2,Encoder_Interface +SH.S_TIM8_CH2.ConfNb=1 TIM4.EncoderMode=TIM_ENCODERMODE_TI12 TIM4.IPParameters=EncoderMode TIM6.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM6.IPParameters=Prescaler,Period,AutoReloadPreload TIM6.Period=1000-1 TIM6.Prescaler=84-1 +TIM8.EncoderMode=TIM_ENCODERMODE_TI12 +TIM8.IPParameters=EncoderMode USART1.IPParameters=VirtualMode USART1.VirtualMode=VM_ASYNC VP_FREERTOS_VS_CMSIS_V1.Mode=CMSIS_V1 diff --git a/MDK-ARM/LWIP.uvoptx b/MDK-ARM/LWIP.uvoptx index f39300b..81e4036 100644 --- a/MDK-ARM/LWIP.uvoptx +++ b/MDK-ARM/LWIP.uvoptx @@ -1,4 +1,4 @@ - + 1.0 @@ -45,7 +45,7 @@ 79 66 8 - + 1 @@ -104,16 +104,16 @@ 0 0 3 - - - - - - - - - - + + + + + + + + + + BIN\CMSIS_AGDI.dll @@ -133,7 +133,7 @@ -U-O142 -O2254 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F407ZETx$CMSIS\Flash\STM32F4xx_512.FLM) - + 0 @@ -163,19 +163,19 @@ 0 0 - - + + 0 0 0 - - - - - - - - + + + + + + + + 1 0 diff --git a/MDK-ARM/LWIP.uvprojx b/MDK-ARM/LWIP.uvprojx index e6217d6..140632b 100644 --- a/MDK-ARM/LWIP.uvprojx +++ b/MDK-ARM/LWIP.uvprojx @@ -1,10 +1,7 @@ - - - + + 2.1 -
### uVision Project, (C) Keil Software
- LWIP @@ -19,28 +16,28 @@ Keil.STM32F4xx_DFP.2.16.0 http://www.keil.com/pack/ IRAM(0x20000000-0x2001FFFF) IRAM2(0x10000000-0x1000FFFF) IROM(0x8000000-0x807FFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") - - - - - - - - - - - - - - + + + + + + + + + + + + + + $$Device:STM32F407ZETx$CMSIS\SVD\STM32F40x.svd 0 0 - - - - - + + + + + 0 0 @@ -55,15 +52,15 @@ 1 1 0 - + 1 0 0 0 0 - - + + 0 0 0 @@ -72,8 +69,8 @@ 0 0 - - + + 0 0 0 @@ -82,15 +79,15 @@ 0 0 - - + + 0 0 0 0 0 - + 0 @@ -104,8 +101,8 @@ 0 0 3 - - + + 0 @@ -138,11 +135,11 @@ 1 STLink\ST-LINKIII-KEIL_SWO.dll - - - - - + + + + + 0 @@ -175,7 +172,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -309,7 +306,7 @@ 0x10000 - + 1 @@ -336,9 +333,9 @@ 0 0 - + USE_HAL_DRIVER,STM32F407xx - + ../Inc;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc @@ -354,9 +351,9 @@ 0 1 - - - + + + ..\\Inc;..\Inc @@ -369,13 +366,13 @@ 0 0x08000000 0x20000000 - - - - - - - + + + + + + + @@ -435,8 +432,6 @@ 2 2 11 - - 1 @@ -464,12 +459,6 @@ 2 2 2 - - - - - - @@ -491,8 +480,6 @@ 2 2 11 - - 1 @@ -520,12 +507,6 @@ 2 2 2 - - - - - - @@ -557,8 +538,6 @@ 2 2 11 - - 1 @@ -586,12 +565,6 @@ 2 2 2 - - - - - - @@ -648,8 +621,6 @@ 2 2 11 - - 0 @@ -677,12 +648,6 @@ 2 2 2 - - - - - - 2 @@ -695,12 +660,6 @@ 2 2 0 - - - - - - @@ -722,8 +681,6 @@ 2 2 11 - - 1 @@ -751,12 +708,6 @@ 2 2 2 - - - - - - @@ -778,8 +729,6 @@ 2 2 11 - - 0 @@ -807,12 +756,6 @@ 2 2 2 - - - - - - 2 @@ -825,12 +768,6 @@ 2 2 0 - - - - - - @@ -852,8 +789,6 @@ 2 2 11 - - 1 @@ -881,12 +816,6 @@ 2 2 2 - - - - - - @@ -908,8 +837,6 @@ 2 2 11 - - 1 @@ -937,12 +864,6 @@ 2 2 2 - - - - - - @@ -964,8 +885,6 @@ 2 2 11 - - 1 @@ -993,12 +912,6 @@ 2 2 2 - - - - - - @@ -1020,8 +933,6 @@ 2 2 11 - - 1 @@ -1049,12 +960,6 @@ 2 2 2 - - - - - - @@ -1076,8 +981,6 @@ 2 2 11 - - 1 @@ -1105,12 +1008,6 @@ 2 2 2 - - - - - - @@ -1132,8 +1029,6 @@ 2 2 11 - - 1 @@ -1161,12 +1056,6 @@ 2 2 2 - - - - - - @@ -1188,8 +1077,6 @@ 2 2 11 - - 1 @@ -1217,12 +1104,6 @@ 2 2 2 - - - - - - @@ -1244,8 +1125,6 @@ 2 2 11 - - 1 @@ -1273,12 +1152,6 @@ 2 2 2 - - - - - - @@ -1300,8 +1173,6 @@ 2 2 11 - - 1 @@ -1329,12 +1200,6 @@ 2 2 2 - - - - - - @@ -1356,8 +1221,6 @@ 2 2 11 - - 1 @@ -1385,12 +1248,6 @@ 2 2 2 - - - - - - @@ -1412,8 +1269,6 @@ 2 2 11 - - 1 @@ -1441,12 +1296,6 @@ 2 2 2 - - - - - - @@ -1468,8 +1317,6 @@ 2 2 11 - - 1 @@ -1497,12 +1344,6 @@ 2 2 2 - - - - - - @@ -1524,8 +1365,6 @@ 2 2 11 - - 1 @@ -1553,12 +1392,6 @@ 2 2 2 - - - - - - @@ -1580,8 +1413,6 @@ 2 2 11 - - 1 @@ -1609,12 +1440,6 @@ 2 2 2 - - - - - - @@ -1636,8 +1461,6 @@ 2 2 11 - - 1 @@ -1665,12 +1488,6 @@ 2 2 2 - - - - - - @@ -1692,8 +1509,6 @@ 2 2 11 - - 1 @@ -1721,12 +1536,6 @@ 2 2 2 - - - - - - @@ -1748,8 +1557,6 @@ 2 2 11 - - 1 @@ -1777,12 +1584,6 @@ 2 2 2 - - - - - - @@ -1804,8 +1605,6 @@ 2 2 11 - - 0 @@ -1833,12 +1632,6 @@ 2 2 2 - - - - - - 2 @@ -1851,12 +1644,6 @@ 2 2 0 - - - - - - @@ -1878,8 +1665,6 @@ 2 2 11 - - 1 @@ -1907,12 +1692,6 @@ 2 2 2 - - - - - - @@ -1934,8 +1713,6 @@ 2 2 11 - - 0 @@ -1963,12 +1740,6 @@ 2 2 2 - - - - - - 2 @@ -1981,12 +1752,6 @@ 2 2 0 - - - - - - @@ -2008,8 +1773,6 @@ 2 2 11 - - 1 @@ -2037,12 +1800,6 @@ 2 2 2 - - - - - - @@ -2064,8 +1821,6 @@ 2 2 11 - - 1 @@ -2093,12 +1848,6 @@ 2 2 2 - - - - - - @@ -2120,8 +1869,6 @@ 2 2 11 - - 1 @@ -2149,12 +1896,6 @@ 2 2 2 - - - - - - @@ -2176,8 +1917,6 @@ 2 2 11 - - 1 @@ -2205,12 +1944,6 @@ 2 2 2 - - - - - - @@ -2232,8 +1965,6 @@ 2 2 11 - - 1 @@ -2261,12 +1992,6 @@ 2 2 2 - - - - - - @@ -2288,8 +2013,6 @@ 2 2 11 - - 1 @@ -2317,12 +2040,6 @@ 2 2 2 - - - - - - @@ -2344,8 +2061,6 @@ 2 2 11 - - 1 @@ -2373,12 +2088,6 @@ 2 2 2 - - - - - - @@ -2400,8 +2109,6 @@ 2 2 11 - - 1 @@ -2429,12 +2136,6 @@ 2 2 2 - - - - - - @@ -2456,8 +2157,6 @@ 2 2 11 - - 1 @@ -2485,12 +2184,6 @@ 2 2 2 - - - - - - @@ -2512,8 +2205,6 @@ 2 2 11 - - 1 @@ -2541,12 +2232,6 @@ 2 2 2 - - - - - - @@ -2568,8 +2253,6 @@ 2 2 11 - - 0 @@ -2597,12 +2280,6 @@ 2 2 2 - - - - - - 2 @@ -2615,12 +2292,6 @@ 2 2 0 - - - - - - @@ -2642,8 +2313,6 @@ 2 2 11 - - 1 @@ -2671,12 +2340,6 @@ 2 2 2 - - - - - - @@ -2698,8 +2361,6 @@ 2 2 11 - - 1 @@ -2727,12 +2388,6 @@ 2 2 2 - - - - - - @@ -2754,8 +2409,6 @@ 2 2 11 - - 1 @@ -2783,12 +2436,6 @@ 2 2 2 - - - - - - @@ -2810,8 +2457,6 @@ 2 2 11 - - 1 @@ -2839,12 +2484,6 @@ 2 2 2 - - - - - - @@ -2866,8 +2505,6 @@ 2 2 11 - - 1 @@ -2895,12 +2532,6 @@ 2 2 2 - - - - - - @@ -2922,8 +2553,6 @@ 2 2 11 - - 1 @@ -2951,12 +2580,6 @@ 2 2 2 - - - - - - @@ -2978,8 +2601,6 @@ 2 2 11 - - 1 @@ -3007,12 +2628,6 @@ 2 2 2 - - - - - - @@ -3034,8 +2649,6 @@ 2 2 11 - - 1 @@ -3063,12 +2676,6 @@ 2 2 2 - - - - - - @@ -3090,8 +2697,6 @@ 2 2 11 - - 1 @@ -3119,12 +2724,6 @@ 2 2 2 - - - - - - @@ -3146,8 +2745,6 @@ 2 2 11 - - 1 @@ -3175,12 +2772,6 @@ 2 2 2 - - - - - - @@ -3202,8 +2793,6 @@ 2 2 11 - - 1 @@ -3231,12 +2820,6 @@ 2 2 2 - - - - - - @@ -3258,8 +2841,6 @@ 2 2 11 - - 1 @@ -3287,12 +2868,6 @@ 2 2 2 - - - - - - @@ -3314,8 +2889,6 @@ 2 2 11 - - 1 @@ -3343,12 +2916,6 @@ 2 2 2 - - - - - - @@ -3370,8 +2937,6 @@ 2 2 11 - - 1 @@ -3399,12 +2964,6 @@ 2 2 2 - - - - - - @@ -3426,8 +2985,6 @@ 2 2 11 - - 1 @@ -3455,12 +3012,6 @@ 2 2 2 - - - - - - @@ -3482,8 +3033,6 @@ 2 2 11 - - 1 @@ -3511,12 +3060,6 @@ 2 2 2 - - - - - - @@ -3538,8 +3081,6 @@ 2 2 11 - - 1 @@ -3567,12 +3108,6 @@ 2 2 2 - - - - - - @@ -3594,8 +3129,6 @@ 2 2 11 - - 1 @@ -3623,12 +3156,6 @@ 2 2 2 - - - - - - @@ -3650,8 +3177,6 @@ 2 2 11 - - 1 @@ -3679,12 +3204,6 @@ 2 2 2 - - - - - - @@ -3706,8 +3225,6 @@ 2 2 11 - - 1 @@ -3735,12 +3252,6 @@ 2 2 2 - - - - - - @@ -3762,8 +3273,6 @@ 2 2 11 - - 1 @@ -3791,12 +3300,6 @@ 2 2 2 - - - - - - @@ -3818,8 +3321,6 @@ 2 2 11 - - 1 @@ -3847,12 +3348,6 @@ 2 2 2 - - - - - - @@ -3874,8 +3369,6 @@ 2 2 11 - - 1 @@ -3903,12 +3396,6 @@ 2 2 2 - - - - - - @@ -3930,8 +3417,6 @@ 2 2 11 - - 1 @@ -3959,12 +3444,6 @@ 2 2 2 - - - - - - @@ -3986,8 +3465,6 @@ 2 2 11 - - 1 @@ -4015,12 +3492,6 @@ 2 2 2 - - - - - - @@ -4042,8 +3513,6 @@ 2 2 11 - - 1 @@ -4071,12 +3540,6 @@ 2 2 2 - - - - - - @@ -4098,8 +3561,6 @@ 2 2 11 - - 1 @@ -4127,12 +3588,6 @@ 2 2 2 - - - - - - @@ -4154,8 +3609,6 @@ 2 2 11 - - 1 @@ -4183,12 +3636,6 @@ 2 2 2 - - - - - - @@ -4210,8 +3657,6 @@ 2 2 11 - - 1 @@ -4239,12 +3684,6 @@ 2 2 2 - - - - - - @@ -4266,8 +3705,6 @@ 2 2 11 - - 1 @@ -4295,12 +3732,6 @@ 2 2 2 - - - - - - @@ -4322,8 +3753,6 @@ 2 2 11 - - 1 @@ -4351,12 +3780,6 @@ 2 2 2 - - - - - - @@ -4378,8 +3801,6 @@ 2 2 11 - - 1 @@ -4407,12 +3828,6 @@ 2 2 2 - - - - - - @@ -4434,8 +3849,6 @@ 2 2 11 - - 1 @@ -4463,12 +3876,6 @@ 2 2 2 - - - - - - @@ -4490,8 +3897,6 @@ 2 2 11 - - 1 @@ -4519,12 +3924,6 @@ 2 2 2 - - - - - - @@ -4546,8 +3945,6 @@ 2 2 11 - - 1 @@ -4575,12 +3972,6 @@ 2 2 2 - - - - - - @@ -4602,8 +3993,6 @@ 2 2 11 - - 1 @@ -4631,12 +4020,6 @@ 2 2 2 - - - - - - @@ -4658,8 +4041,6 @@ 2 2 11 - - 1 @@ -4687,12 +4068,6 @@ 2 2 2 - - - - - - @@ -4714,8 +4089,6 @@ 2 2 11 - - 1 @@ -4743,12 +4116,6 @@ 2 2 2 - - - - - - @@ -4770,8 +4137,6 @@ 2 2 11 - - 1 @@ -4799,12 +4164,6 @@ 2 2 2 - - - - - - @@ -4826,8 +4185,6 @@ 2 2 11 - - 1 @@ -4855,12 +4212,6 @@ 2 2 2 - - - - - - @@ -4882,8 +4233,6 @@ 2 2 11 - - 1 @@ -4911,12 +4260,6 @@ 2 2 2 - - - - - - @@ -4938,8 +4281,6 @@ 2 2 11 - - 1 @@ -4967,12 +4308,6 @@ 2 2 2 - - - - - - @@ -4994,8 +4329,6 @@ 2 2 11 - - 1 @@ -5023,12 +4356,6 @@ 2 2 2 - - - - - - @@ -5050,8 +4377,6 @@ 2 2 11 - - 1 @@ -5079,12 +4404,6 @@ 2 2 2 - - - - - - @@ -5106,8 +4425,6 @@ 2 2 11 - - 1 @@ -5135,12 +4452,6 @@ 2 2 2 - - - - - - @@ -5162,8 +4473,6 @@ 2 2 11 - - 1 @@ -5191,12 +4500,6 @@ 2 2 2 - - - - - - @@ -5218,8 +4521,6 @@ 2 2 11 - - 1 @@ -5247,12 +4548,6 @@ 2 2 2 - - - - - - @@ -5274,8 +4569,6 @@ 2 2 11 - - 1 @@ -5303,12 +4596,6 @@ 2 2 2 - - - - - - @@ -5330,8 +4617,6 @@ 2 2 11 - - 1 @@ -5359,12 +4644,6 @@ 2 2 2 - - - - - - @@ -5386,8 +4665,6 @@ 2 2 11 - - 1 @@ -5415,12 +4692,6 @@ 2 2 2 - - - - - - @@ -5442,8 +4713,6 @@ 2 2 11 - - 1 @@ -5471,12 +4740,6 @@ 2 2 2 - - - - - - @@ -5498,8 +4761,6 @@ 2 2 11 - - 1 @@ -5527,12 +4788,6 @@ 2 2 2 - - - - - - @@ -5554,8 +4809,6 @@ 2 2 11 - - 1 @@ -5583,12 +4836,6 @@ 2 2 2 - - - - - - @@ -5610,8 +4857,6 @@ 2 2 11 - - 1 @@ -5639,12 +4884,6 @@ 2 2 2 - - - - - - @@ -5666,8 +4905,6 @@ 2 2 11 - - 1 @@ -5695,12 +4932,6 @@ 2 2 2 - - - - - - @@ -5722,8 +4953,6 @@ 2 2 11 - - 1 @@ -5751,12 +4980,6 @@ 2 2 2 - - - - - - @@ -5778,8 +5001,6 @@ 2 2 11 - - 1 @@ -5807,12 +5028,6 @@ 2 2 2 - - - - - - @@ -5834,8 +5049,6 @@ 2 2 11 - - 1 @@ -5863,12 +5076,6 @@ 2 2 2 - - - - - - @@ -5890,8 +5097,6 @@ 2 2 11 - - 1 @@ -5919,12 +5124,6 @@ 2 2 2 - - - - - - @@ -5946,8 +5145,6 @@ 2 2 11 - - 1 @@ -5975,12 +5172,6 @@ 2 2 2 - - - - - - @@ -6002,8 +5193,6 @@ 2 2 11 - - 1 @@ -6031,12 +5220,6 @@ 2 2 2 - - - - - - @@ -6058,8 +5241,6 @@ 2 2 11 - - 1 @@ -6087,12 +5268,6 @@ 2 2 2 - - - - - - @@ -6114,8 +5289,6 @@ 2 2 11 - - 1 @@ -6143,12 +5316,6 @@ 2 2 2 - - - - - - @@ -6170,8 +5337,6 @@ 2 2 11 - - 1 @@ -6199,12 +5364,6 @@ 2 2 2 - - - - - - @@ -6226,8 +5385,6 @@ 2 2 11 - - 1 @@ -6255,12 +5412,6 @@ 2 2 2 - - - - - - @@ -6282,8 +5433,6 @@ 2 2 11 - - 1 @@ -6311,12 +5460,6 @@ 2 2 2 - - - - - - @@ -6338,8 +5481,6 @@ 2 2 11 - - 1 @@ -6367,12 +5508,6 @@ 2 2 2 - - - - - - @@ -6394,8 +5529,6 @@ 2 2 11 - - 1 @@ -6423,12 +5556,6 @@ 2 2 2 - - - - - - @@ -6450,8 +5577,6 @@ 2 2 11 - - 1 @@ -6479,12 +5604,6 @@ 2 2 2 - - - - - - @@ -6506,8 +5625,6 @@ 2 2 11 - - 1 @@ -6535,12 +5652,6 @@ 2 2 2 - - - - - - @@ -6562,8 +5673,6 @@ 2 2 11 - - 1 @@ -6591,12 +5700,6 @@ 2 2 2 - - - - - - @@ -6618,8 +5721,6 @@ 2 2 11 - - 1 @@ -6647,12 +5748,6 @@ 2 2 2 - - - - - - @@ -6674,8 +5769,6 @@ 2 2 11 - - 1 @@ -6703,12 +5796,6 @@ 2 2 2 - - - - - - @@ -6730,8 +5817,6 @@ 2 2 11 - - 1 @@ -6759,12 +5844,6 @@ 2 2 2 - - - - - - @@ -6786,8 +5865,6 @@ 2 2 11 - - 1 @@ -6815,12 +5892,6 @@ 2 2 2 - - - - - - @@ -6842,8 +5913,6 @@ 2 2 11 - - 1 @@ -6871,12 +5940,6 @@ 2 2 2 - - - - - - @@ -6898,8 +5961,6 @@ 2 2 11 - - 1 @@ -6927,12 +5988,6 @@ 2 2 2 - - - - - - @@ -6954,8 +6009,6 @@ 2 2 11 - - 1 @@ -6983,12 +6036,6 @@ 2 2 2 - - - - - - @@ -7010,8 +6057,6 @@ 2 2 11 - - 1 @@ -7039,12 +6084,6 @@ 2 2 2 - - - - - - @@ -7066,8 +6105,6 @@ 2 2 11 - - 1 @@ -7095,12 +6132,6 @@ 2 2 2 - - - - - - @@ -7122,8 +6153,6 @@ 2 2 11 - - 1 @@ -7151,12 +6180,6 @@ 2 2 2 - - - - - - @@ -7169,18 +6192,17 @@ - - + - + - + - + -
+ diff --git a/Src/freertos.c b/Src/freertos.c index 345c5ad..d15f5ec 100644 --- a/Src/freertos.c +++ b/Src/freertos.c @@ -156,8 +156,7 @@ void MX_FREERTOS_Init(void) { void StartDefaultTask(void const * argument) { /* init code for LWIP */ - // MX_LWIP_Init(); - MX_LWIP_STATIC_Init(); + MX_LWIP_Init(); /* USER CODE BEGIN StartDefaultTask */ osThreadDef(mainTask, StartMainTask, osPriorityNormal, 0, 1024); mainTaskHandle = osThreadCreate(osThread(mainTask), NULL); diff --git a/Src/main.c b/Src/main.c index f59bdb8..17c4815 100644 --- a/Src/main.c +++ b/Src/main.c @@ -94,6 +94,7 @@ int main(void) MX_TIM6_Init(); MX_USART1_UART_Init(); MX_TIM4_Init(); + MX_TIM8_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ diff --git a/Src/tim.c b/Src/tim.c index 8e87730..a20c812 100644 --- a/Src/tim.c +++ b/Src/tim.c @@ -26,6 +26,7 @@ TIM_HandleTypeDef htim4; TIM_HandleTypeDef htim6; +TIM_HandleTypeDef htim8; /* TIM4 init function */ void MX_TIM4_Init(void) @@ -104,6 +105,51 @@ void MX_TIM6_Init(void) /* USER CODE END TIM6_Init 2 */ } +/* TIM8 init function */ +void MX_TIM8_Init(void) +{ + + /* USER CODE BEGIN TIM8_Init 0 */ + + /* USER CODE END TIM8_Init 0 */ + + TIM_Encoder_InitTypeDef sConfig = {0}; + TIM_MasterConfigTypeDef sMasterConfig = {0}; + + /* USER CODE BEGIN TIM8_Init 1 */ + + /* USER CODE END TIM8_Init 1 */ + htim8.Instance = TIM8; + htim8.Init.Prescaler = 0; + htim8.Init.CounterMode = TIM_COUNTERMODE_UP; + htim8.Init.Period = 65535; + htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + htim8.Init.RepetitionCounter = 0; + htim8.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + sConfig.EncoderMode = TIM_ENCODERMODE_TI12; + sConfig.IC1Polarity = TIM_ICPOLARITY_RISING; + sConfig.IC1Selection = TIM_ICSELECTION_DIRECTTI; + sConfig.IC1Prescaler = TIM_ICPSC_DIV1; + sConfig.IC1Filter = 0; + sConfig.IC2Polarity = TIM_ICPOLARITY_RISING; + sConfig.IC2Selection = TIM_ICSELECTION_DIRECTTI; + sConfig.IC2Prescaler = TIM_ICPSC_DIV1; + sConfig.IC2Filter = 0; + if (HAL_TIM_Encoder_Init(&htim8, &sConfig) != HAL_OK) + { + Error_Handler(); + } + sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; + sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; + if (HAL_TIMEx_MasterConfigSynchronization(&htim8, &sMasterConfig) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN TIM8_Init 2 */ + + /* USER CODE END TIM8_Init 2 */ + +} void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* tim_encoderHandle) { @@ -133,6 +179,30 @@ void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* tim_encoderHandle) /* USER CODE END TIM4_MspInit 1 */ } + else if(tim_encoderHandle->Instance==TIM8) + { + /* USER CODE BEGIN TIM8_MspInit 0 */ + + /* USER CODE END TIM8_MspInit 0 */ + /* TIM8 clock enable */ + __HAL_RCC_TIM8_CLK_ENABLE(); + + __HAL_RCC_GPIOC_CLK_ENABLE(); + /**TIM8 GPIO Configuration + PC6 ------> TIM8_CH1 + PC7 ------> TIM8_CH2 + */ + GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + GPIO_InitStruct.Alternate = GPIO_AF3_TIM8; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /* USER CODE BEGIN TIM8_MspInit 1 */ + + /* USER CODE END TIM8_MspInit 1 */ + } } void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle) @@ -176,6 +246,24 @@ void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* tim_encoderHandle) /* USER CODE END TIM4_MspDeInit 1 */ } + else if(tim_encoderHandle->Instance==TIM8) + { + /* USER CODE BEGIN TIM8_MspDeInit 0 */ + + /* USER CODE END TIM8_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM8_CLK_DISABLE(); + + /**TIM8 GPIO Configuration + PC6 ------> TIM8_CH1 + PC7 ------> TIM8_CH2 + */ + HAL_GPIO_DeInit(GPIOC, GPIO_PIN_6|GPIO_PIN_7); + + /* USER CODE BEGIN TIM8_MspDeInit 1 */ + + /* USER CODE END TIM8_MspDeInit 1 */ + } } void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)