diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index a021519..f47c628 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 4d81392..869fb2d 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -55,6 +55,9 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3|GPIO_PIN_7, GPIO_PIN_SET); + /*Configure GPIO pins : PE2 PE3 PE4 PE5 PE6 PE7 PE8 PE9 PE10 PE11 PE12 PE13 @@ -68,13 +71,11 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); /*Configure GPIO pins : PC13 PC14 PC15 PC1 - PC2 PC3 PC5 PC6 - PC7 PC8 PC10 PC11 - PC12 */ + PC2 PC5 PC6 PC8 + PC10 PC11 PC12 */ GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_1 - |GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_5|GPIO_PIN_6 - |GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_10|GPIO_PIN_11 - |GPIO_PIN_12; + |GPIO_PIN_2|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8 + |GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); @@ -85,6 +86,13 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + /*Configure GPIO pins : PC3 PC7 */ + GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_7; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + /*Configure GPIO pins : PA0 PA1 PA4 PA8 PA15 */ GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_8 diff --git a/Intelligent_winding_robot_hbot.ioc b/Intelligent_winding_robot_hbot.ioc index 6270449..8705a1b 100644 --- a/Intelligent_winding_robot_hbot.ioc +++ b/Intelligent_winding_robot_hbot.ioc @@ -84,33 +84,35 @@ Mcu.Name=STM32F407V(E-G)Tx Mcu.Package=LQFP100 Mcu.Pin0=PH0-OSC_IN Mcu.Pin1=PH1-OSC_OUT -Mcu.Pin10=PB11 -Mcu.Pin11=PC9 -Mcu.Pin12=PA9 -Mcu.Pin13=PA10 -Mcu.Pin14=PA11 -Mcu.Pin15=PA12 -Mcu.Pin16=PA13 -Mcu.Pin17=PA14 -Mcu.Pin18=PB6 -Mcu.Pin19=PB7 +Mcu.Pin10=PB10 +Mcu.Pin11=PB11 +Mcu.Pin12=PC7 +Mcu.Pin13=PC9 +Mcu.Pin14=PA9 +Mcu.Pin15=PA10 +Mcu.Pin16=PA11 +Mcu.Pin17=PA12 +Mcu.Pin18=PA13 +Mcu.Pin19=PA14 Mcu.Pin2=PC0 -Mcu.Pin20=VP_CRC_VS_CRC -Mcu.Pin21=VP_FREERTOS_VS_CMSIS_V1 -Mcu.Pin22=VP_RNG_VS_RNG -Mcu.Pin23=VP_SYS_VS_tim11 -Mcu.Pin24=VP_TIM1_VS_ClockSourceINT -Mcu.Pin25=VP_TIM3_VS_ClockSourceINT -Mcu.Pin26=VP_TIM6_VS_ClockSourceINT -Mcu.Pin27=VP_TIM7_VS_ClockSourceINT -Mcu.Pin3=PA2 -Mcu.Pin4=PA3 -Mcu.Pin5=PA5 -Mcu.Pin6=PA6 -Mcu.Pin7=PA7 -Mcu.Pin8=PC4 -Mcu.Pin9=PB10 -Mcu.PinsNb=28 +Mcu.Pin20=PB6 +Mcu.Pin21=PB7 +Mcu.Pin22=VP_CRC_VS_CRC +Mcu.Pin23=VP_FREERTOS_VS_CMSIS_V1 +Mcu.Pin24=VP_RNG_VS_RNG +Mcu.Pin25=VP_SYS_VS_tim11 +Mcu.Pin26=VP_TIM1_VS_ClockSourceINT +Mcu.Pin27=VP_TIM3_VS_ClockSourceINT +Mcu.Pin28=VP_TIM6_VS_ClockSourceINT +Mcu.Pin29=VP_TIM7_VS_ClockSourceINT +Mcu.Pin3=PC3 +Mcu.Pin4=PA2 +Mcu.Pin5=PA3 +Mcu.Pin6=PA5 +Mcu.Pin7=PA6 +Mcu.Pin8=PA7 +Mcu.Pin9=PC4 +Mcu.PinsNb=30 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F407VETx @@ -180,8 +182,19 @@ PB7.Mode=I2C PB7.Signal=I2C1_SDA PC0.Locked=true PC0.Signal=GPXTI0 +PC3.GPIOParameters=PinState,GPIO_PuPd +PC3.GPIO_PuPd=GPIO_PULLUP +PC3.Locked=true +PC3.PinState=GPIO_PIN_SET +PC3.Signal=GPIO_Output PC4.Locked=true PC4.Signal=GPXTI4 +PC7.GPIOParameters=PinState,GPIO_PuPd,GPIO_ModeDefaultOutputPP +PC7.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP +PC7.GPIO_PuPd=GPIO_PULLUP +PC7.Locked=true +PC7.PinState=GPIO_PIN_SET +PC7.Signal=GPIO_Output PC9.Locked=true PC9.Mode=Clock-out-2 PC9.Signal=RCC_MCO_2 diff --git a/sdk b/sdk index 1bd944d..6ceb8d9 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 1bd944d7ea168f6378ac8d8da86badf4c2f0ba27 +Subproject commit 6ceb8d97e51bb2a68aa4c50541ebfb4866f69c4f diff --git a/usrc/board.h b/usrc/board.h index a22ba29..4411905 100644 --- a/usrc/board.h +++ b/usrc/board.h @@ -1,6 +1,6 @@ #pragma once -#define BOARD_ID 1 +#define BOARD_ID 2 #define TMC_MOTOR_SPI hspi1 // MOTOR1 diff --git a/usrc/main.cpp b/usrc/main.cpp index cadebf3..048e14d 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -61,6 +61,12 @@ static void initsubmodule() { ZLOGI(TAG, "motora initialize TMC4361A:%x DriverIC:%x", motora.readICVersion(), motora.readSubICVersion()); } + motora.setAcceleration(300); + motora.setDeceleration(300); + motora.setIHOLD_IRUN(0, 1, 10); + motora.enable(false); + + osDelay(1000); { TMC4361A::cfg_t cfg = { .spi = &TMC_MOTOR_SPI, // @@ -76,16 +82,10 @@ static void initsubmodule() { motorb.setGLOBAL_SCALER(32); ZLOGI(TAG, "motorb initialize TMC4361A:%x DriverIC:%x", motorb.readICVersion(), motorb.readSubICVersion()); } - - motora.setAcceleration(300); - motora.setDeceleration(300); - motora.setIHOLD_IRUN(0, 1, 10); - + osDelay(1000); motorb.setAcceleration(300); motorb.setDeceleration(300); motorb.setIHOLD_IRUN(0, 1, 10); - - motora.enable(false); motorb.enable(false); /*******************************************************************************