mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-20 22:14:34 +08:00
Merge branch 'sam_v3.5_post_refactoring' into sam_testing
This commit is contained in:
@@ -58,6 +58,9 @@
|
||||
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 1 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 2
|
||||
#include "prev_board_ver/main_V3_2.h"
|
||||
#elif HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 3 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 4
|
||||
#include "prev_board_ver/main_V3_4.h"
|
||||
#else
|
||||
/* USER CODE END Includes */
|
||||
|
||||
@@ -74,8 +77,8 @@
|
||||
#define M0_nCS_GPIO_Port GPIOC
|
||||
#define M1_nCS_Pin GPIO_PIN_14
|
||||
#define M1_nCS_GPIO_Port GPIOC
|
||||
#define M1_DC_CAL_Pin GPIO_PIN_15
|
||||
#define M1_DC_CAL_GPIO_Port GPIOC
|
||||
#define M1_ENC_Z_Pin GPIO_PIN_15
|
||||
#define M1_ENC_Z_GPIO_Port GPIOC
|
||||
#define M0_IB_Pin GPIO_PIN_0
|
||||
#define M0_IB_GPIO_Port GPIOC
|
||||
#define M0_IC_Pin GPIO_PIN_1
|
||||
@@ -95,22 +98,22 @@
|
||||
#define GPIO_4_GPIO_Port GPIOA
|
||||
#define M1_TEMP_Pin GPIO_PIN_4
|
||||
#define M1_TEMP_GPIO_Port GPIOA
|
||||
#define AUX_I_Pin GPIO_PIN_5
|
||||
#define AUX_I_GPIO_Port GPIOA
|
||||
#define AUX_TEMP_Pin GPIO_PIN_5
|
||||
#define AUX_TEMP_GPIO_Port GPIOA
|
||||
#define VBUS_S_Pin GPIO_PIN_6
|
||||
#define VBUS_S_GPIO_Port GPIOA
|
||||
#define M1_AL_Pin GPIO_PIN_7
|
||||
#define M1_AL_GPIO_Port GPIOA
|
||||
#define AUX_TEMP_Pin GPIO_PIN_4
|
||||
#define AUX_TEMP_GPIO_Port GPIOC
|
||||
#define GPIO_5_Pin GPIO_PIN_4
|
||||
#define GPIO_5_GPIO_Port GPIOC
|
||||
#define M0_TEMP_Pin GPIO_PIN_5
|
||||
#define M0_TEMP_GPIO_Port GPIOC
|
||||
#define M1_BL_Pin GPIO_PIN_0
|
||||
#define M1_BL_GPIO_Port GPIOB
|
||||
#define M1_CL_Pin GPIO_PIN_1
|
||||
#define M1_CL_GPIO_Port GPIOB
|
||||
#define GPIO_5_Pin GPIO_PIN_2
|
||||
#define GPIO_5_GPIO_Port GPIOB
|
||||
#define GPIO_6_Pin GPIO_PIN_2
|
||||
#define GPIO_6_GPIO_Port GPIOB
|
||||
#define AUX_L_Pin GPIO_PIN_10
|
||||
#define AUX_L_GPIO_Port GPIOB
|
||||
#define AUX_H_Pin GPIO_PIN_11
|
||||
@@ -129,20 +132,20 @@
|
||||
#define M1_BH_GPIO_Port GPIOC
|
||||
#define M1_CH_Pin GPIO_PIN_8
|
||||
#define M1_CH_GPIO_Port GPIOC
|
||||
#define M0_DC_CAL_Pin GPIO_PIN_9
|
||||
#define M0_DC_CAL_GPIO_Port GPIOC
|
||||
#define M0_ENC_Z_Pin GPIO_PIN_9
|
||||
#define M0_ENC_Z_GPIO_Port GPIOC
|
||||
#define M0_AH_Pin GPIO_PIN_8
|
||||
#define M0_AH_GPIO_Port GPIOA
|
||||
#define M0_BH_Pin GPIO_PIN_9
|
||||
#define M0_BH_GPIO_Port GPIOA
|
||||
#define M0_CH_Pin GPIO_PIN_10
|
||||
#define M0_CH_GPIO_Port GPIOA
|
||||
#define M0_ENC_Z_Pin GPIO_PIN_15
|
||||
#define M0_ENC_Z_GPIO_Port GPIOA
|
||||
#define GPIO_7_Pin GPIO_PIN_15
|
||||
#define GPIO_7_GPIO_Port GPIOA
|
||||
#define nFAULT_Pin GPIO_PIN_2
|
||||
#define nFAULT_GPIO_Port GPIOD
|
||||
#define M1_ENC_Z_Pin GPIO_PIN_3
|
||||
#define M1_ENC_Z_GPIO_Port GPIOB
|
||||
#define GPIO_8_Pin GPIO_PIN_3
|
||||
#define GPIO_8_GPIO_Port GPIOB
|
||||
#define M0_ENC_A_Pin GPIO_PIN_4
|
||||
#define M0_ENC_A_GPIO_Port GPIOB
|
||||
#define M0_ENC_B_Pin GPIO_PIN_5
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define TIM_APB1_CLOCK_HZ 84000000
|
||||
#define TIM_APB1_PERIOD_CLOCKS 4096
|
||||
#define TIM_APB1_DEADTIME_CLOCKS 40
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||
|
||||
#define M0_nCS_Pin GPIO_PIN_13
|
||||
#define M0_nCS_GPIO_Port GPIOC
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define TIM_1_8_CLOCK_HZ 168000000
|
||||
#define TIM_1_8_PERIOD_CLOCKS 10192
|
||||
#define TIM_1_8_DEADTIME_CLOCKS 20
|
||||
#define TIM_APB1_CLOCK_HZ 84000000
|
||||
#define TIM_APB1_PERIOD_CLOCKS 4096
|
||||
#define TIM_APB1_DEADTIME_CLOCKS 40
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||
|
||||
#define M0_nCS_Pin GPIO_PIN_13
|
||||
#define M0_nCS_GPIO_Port GPIOC
|
||||
#define M1_nCS_Pin GPIO_PIN_14
|
||||
#define M1_nCS_GPIO_Port GPIOC
|
||||
#define M1_DC_CAL_Pin GPIO_PIN_15
|
||||
#define M1_DC_CAL_GPIO_Port GPIOC
|
||||
#define M0_IB_Pin GPIO_PIN_0
|
||||
#define M0_IB_GPIO_Port GPIOC
|
||||
#define M0_IC_Pin GPIO_PIN_1
|
||||
#define M0_IC_GPIO_Port GPIOC
|
||||
#define M1_IC_Pin GPIO_PIN_2
|
||||
#define M1_IC_GPIO_Port GPIOC
|
||||
#define M1_IB_Pin GPIO_PIN_3
|
||||
#define M1_IB_GPIO_Port GPIOC
|
||||
#define GPIO_1_Pin GPIO_PIN_0
|
||||
#define GPIO_1_GPIO_Port GPIOA
|
||||
#define GPIO_2_Pin GPIO_PIN_1
|
||||
#define GPIO_2_GPIO_Port GPIOA
|
||||
#define GPIO_3_Pin GPIO_PIN_2
|
||||
#define GPIO_3_GPIO_Port GPIOA
|
||||
#define GPIO_3_EXTI_IRQn EXTI2_IRQn
|
||||
#define GPIO_4_Pin GPIO_PIN_3
|
||||
#define GPIO_4_GPIO_Port GPIOA
|
||||
#define M1_TEMP_Pin GPIO_PIN_4
|
||||
#define M1_TEMP_GPIO_Port GPIOA
|
||||
#define AUX_I_Pin GPIO_PIN_5
|
||||
#define AUX_I_GPIO_Port GPIOA
|
||||
#define VBUS_S_Pin GPIO_PIN_6
|
||||
#define VBUS_S_GPIO_Port GPIOA
|
||||
#define M1_AL_Pin GPIO_PIN_7
|
||||
#define M1_AL_GPIO_Port GPIOA
|
||||
#define AUX_TEMP_Pin GPIO_PIN_4
|
||||
#define AUX_TEMP_GPIO_Port GPIOC
|
||||
#define M0_TEMP_Pin GPIO_PIN_5
|
||||
#define M0_TEMP_GPIO_Port GPIOC
|
||||
#define M1_BL_Pin GPIO_PIN_0
|
||||
#define M1_BL_GPIO_Port GPIOB
|
||||
#define M1_CL_Pin GPIO_PIN_1
|
||||
#define M1_CL_GPIO_Port GPIOB
|
||||
#define GPIO_5_Pin GPIO_PIN_2
|
||||
#define GPIO_5_GPIO_Port GPIOB
|
||||
#define AUX_L_Pin GPIO_PIN_10
|
||||
#define AUX_L_GPIO_Port GPIOB
|
||||
#define AUX_H_Pin GPIO_PIN_11
|
||||
#define AUX_H_GPIO_Port GPIOB
|
||||
#define EN_GATE_Pin GPIO_PIN_12
|
||||
#define EN_GATE_GPIO_Port GPIOB
|
||||
#define M0_AL_Pin GPIO_PIN_13
|
||||
#define M0_AL_GPIO_Port GPIOB
|
||||
#define M0_BL_Pin GPIO_PIN_14
|
||||
#define M0_BL_GPIO_Port GPIOB
|
||||
#define M0_CL_Pin GPIO_PIN_15
|
||||
#define M0_CL_GPIO_Port GPIOB
|
||||
#define M1_AH_Pin GPIO_PIN_6
|
||||
#define M1_AH_GPIO_Port GPIOC
|
||||
#define M1_BH_Pin GPIO_PIN_7
|
||||
#define M1_BH_GPIO_Port GPIOC
|
||||
#define M1_CH_Pin GPIO_PIN_8
|
||||
#define M1_CH_GPIO_Port GPIOC
|
||||
#define M0_DC_CAL_Pin GPIO_PIN_9
|
||||
#define M0_DC_CAL_GPIO_Port GPIOC
|
||||
#define M0_AH_Pin GPIO_PIN_8
|
||||
#define M0_AH_GPIO_Port GPIOA
|
||||
#define M0_BH_Pin GPIO_PIN_9
|
||||
#define M0_BH_GPIO_Port GPIOA
|
||||
#define M0_CH_Pin GPIO_PIN_10
|
||||
#define M0_CH_GPIO_Port GPIOA
|
||||
#define M0_ENC_Z_Pin GPIO_PIN_15
|
||||
#define M0_ENC_Z_GPIO_Port GPIOA
|
||||
#define nFAULT_Pin GPIO_PIN_2
|
||||
#define nFAULT_GPIO_Port GPIOD
|
||||
#define M1_ENC_Z_Pin GPIO_PIN_3
|
||||
#define M1_ENC_Z_GPIO_Port GPIOB
|
||||
#define M0_ENC_A_Pin GPIO_PIN_4
|
||||
#define M0_ENC_A_GPIO_Port GPIOB
|
||||
#define M0_ENC_B_Pin GPIO_PIN_5
|
||||
#define M0_ENC_B_GPIO_Port GPIOB
|
||||
#define M1_ENC_A_Pin GPIO_PIN_6
|
||||
#define M1_ENC_A_GPIO_Port GPIOB
|
||||
#define M1_ENC_B_Pin GPIO_PIN_7
|
||||
#define M1_ENC_B_GPIO_Port GPIOB
|
||||
@@ -238,7 +238,7 @@ PA13.Signal=SYS_JTMS-SWDIO
|
||||
PA14.Mode=Serial_Wire
|
||||
PA14.Signal=SYS_JTCK-SWCLK
|
||||
PA15.GPIOParameters=GPIO_Label
|
||||
PA15.GPIO_Label=M0_ENC_Z
|
||||
PA15.GPIO_Label=GPIO_7
|
||||
PA15.Locked=true
|
||||
PA15.Signal=GPIO_Input
|
||||
PA2.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||
@@ -256,7 +256,7 @@ PA4.GPIO_Label=M1_TEMP
|
||||
PA4.Locked=true
|
||||
PA4.Signal=ADCx_IN4
|
||||
PA5.GPIOParameters=GPIO_Label
|
||||
PA5.GPIO_Label=AUX_I
|
||||
PA5.GPIO_Label=AUX_TEMP
|
||||
PA5.Locked=true
|
||||
PA5.Signal=ADCx_IN5
|
||||
PA6.GPIOParameters=GPIO_Label
|
||||
@@ -314,11 +314,11 @@ PB15.Locked=true
|
||||
PB15.Mode=PWM Generation3 CH3 CH3N
|
||||
PB15.Signal=TIM1_CH3N
|
||||
PB2.GPIOParameters=GPIO_Label
|
||||
PB2.GPIO_Label=GPIO_5
|
||||
PB2.GPIO_Label=GPIO_6
|
||||
PB2.Locked=true
|
||||
PB2.Signal=GPIO_Input
|
||||
PB3.GPIOParameters=GPIO_Label
|
||||
PB3.GPIO_Label=M1_ENC_Z
|
||||
PB3.GPIO_Label=GPIO_8
|
||||
PB3.Locked=true
|
||||
PB3.Signal=GPIO_Input
|
||||
PB4.GPIOParameters=GPIO_Label
|
||||
@@ -360,9 +360,9 @@ PC14-OSC32_IN.Locked=true
|
||||
PC14-OSC32_IN.PinState=GPIO_PIN_SET
|
||||
PC14-OSC32_IN.Signal=GPIO_Output
|
||||
PC15-OSC32_OUT.GPIOParameters=GPIO_Label
|
||||
PC15-OSC32_OUT.GPIO_Label=M1_DC_CAL
|
||||
PC15-OSC32_OUT.GPIO_Label=M1_ENC_Z
|
||||
PC15-OSC32_OUT.Locked=true
|
||||
PC15-OSC32_OUT.Signal=GPIO_Output
|
||||
PC15-OSC32_OUT.Signal=GPIO_Input
|
||||
PC2.GPIOParameters=GPIO_Label
|
||||
PC2.GPIO_Label=M1_IC
|
||||
PC2.Signal=ADCx_IN12
|
||||
@@ -370,8 +370,9 @@ PC3.GPIOParameters=GPIO_Label
|
||||
PC3.GPIO_Label=M1_IB
|
||||
PC3.Signal=ADCx_IN13
|
||||
PC4.GPIOParameters=GPIO_Label
|
||||
PC4.GPIO_Label=AUX_TEMP
|
||||
PC4.Signal=ADCx_IN14
|
||||
PC4.GPIO_Label=GPIO_5
|
||||
PC4.Locked=true
|
||||
PC4.Signal=GPIO_Input
|
||||
PC5.GPIOParameters=GPIO_Label
|
||||
PC5.GPIO_Label=M0_TEMP
|
||||
PC5.Signal=ADCx_IN15
|
||||
@@ -388,9 +389,9 @@ PC8.GPIO_Label=M1_CH
|
||||
PC8.Locked=true
|
||||
PC8.Signal=S_TIM8_CH3
|
||||
PC9.GPIOParameters=GPIO_Label
|
||||
PC9.GPIO_Label=M0_DC_CAL
|
||||
PC9.GPIO_Label=M0_ENC_Z
|
||||
PC9.Locked=true
|
||||
PC9.Signal=GPIO_Output
|
||||
PC9.Signal=GPIO_Input
|
||||
PCC.Checker=false
|
||||
PCC.Line=STM32F405/415
|
||||
PCC.MCU=STM32F405RGTx
|
||||
@@ -484,9 +485,6 @@ SH.ADCx_IN13.0=ADC1_IN13,IN13
|
||||
SH.ADCx_IN13.1=ADC2_IN13,IN13
|
||||
SH.ADCx_IN13.2=ADC3_IN13,IN13
|
||||
SH.ADCx_IN13.ConfNb=3
|
||||
SH.ADCx_IN14.0=ADC1_IN14,IN14
|
||||
SH.ADCx_IN14.1=ADC2_IN14,IN14
|
||||
SH.ADCx_IN14.ConfNb=2
|
||||
SH.ADCx_IN15.0=ADC1_IN15,IN15
|
||||
SH.ADCx_IN15.1=ADC2_IN15,IN15
|
||||
SH.ADCx_IN15.ConfNb=2
|
||||
|
||||
+11
-12
@@ -57,6 +57,9 @@
|
||||
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 1 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 2
|
||||
#include "prev_board_ver/adc_V3_2.c"
|
||||
#elif HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 3 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 4
|
||||
#include "prev_board_ver/adc_V3_4.c"
|
||||
#else
|
||||
/* USER CODE END 0 */
|
||||
|
||||
@@ -241,16 +244,15 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
PA4 ------> ADC1_IN4
|
||||
PA5 ------> ADC1_IN5
|
||||
PA6 ------> ADC1_IN6
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
*/
|
||||
GPIO_InitStruct.Pin = M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin;
|
||||
|M0_TEMP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_TEMP_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
@@ -278,16 +280,15 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
PA4 ------> ADC2_IN4
|
||||
PA5 ------> ADC2_IN5
|
||||
PA6 ------> ADC2_IN6
|
||||
PC4 ------> ADC2_IN14
|
||||
PC5 ------> ADC2_IN15
|
||||
*/
|
||||
GPIO_InitStruct.Pin = M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin;
|
||||
|M0_TEMP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_TEMP_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
@@ -346,13 +347,12 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
||||
PA4 ------> ADC1_IN4
|
||||
PA5 ------> ADC1_IN5
|
||||
PA6 ------> ADC1_IN6
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin);
|
||||
|M0_TEMP_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin);
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_TEMP_Pin|VBUS_S_Pin);
|
||||
|
||||
/* ADC1 interrupt Deinit */
|
||||
/* USER CODE BEGIN ADC1:ADC_IRQn disable */
|
||||
@@ -383,13 +383,12 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
||||
PA4 ------> ADC2_IN4
|
||||
PA5 ------> ADC2_IN5
|
||||
PA6 ------> ADC2_IN6
|
||||
PC4 ------> ADC2_IN14
|
||||
PC5 ------> ADC2_IN15
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin);
|
||||
|M0_TEMP_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin);
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_TEMP_Pin|VBUS_S_Pin);
|
||||
|
||||
/* ADC2 interrupt Deinit */
|
||||
/* USER CODE BEGIN ADC2:ADC_IRQn disable */
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 1 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 2
|
||||
#include "prev_board_ver/gpio_V3_2.c"
|
||||
#elif HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 3 \
|
||||
|| HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR == 4
|
||||
#include "prev_board_ver/gpio_V3_4.c"
|
||||
#else
|
||||
/* USER CODE END 0 */
|
||||
|
||||
@@ -87,19 +90,22 @@ void MX_GPIO_Init(void)
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, M0_nCS_Pin|M1_nCS_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, M1_DC_CAL_Pin|M0_DC_CAL_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(EN_GATE_GPIO_Port, EN_GATE_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : PCPin PCPin PCPin PCPin */
|
||||
GPIO_InitStruct.Pin = M0_nCS_Pin|M1_nCS_Pin|M1_DC_CAL_Pin|M0_DC_CAL_Pin;
|
||||
/*Configure GPIO pins : PCPin PCPin */
|
||||
GPIO_InitStruct.Pin = M0_nCS_Pin|M1_nCS_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PCPin PCPin PCPin */
|
||||
GPIO_InitStruct.Pin = M1_ENC_Z_Pin|GPIO_5_Pin|M0_ENC_Z_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = GPIO_3_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||
@@ -107,13 +113,13 @@ void MX_GPIO_Init(void)
|
||||
HAL_GPIO_Init(GPIO_3_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = GPIO_4_Pin|M0_ENC_Z_Pin;
|
||||
GPIO_InitStruct.Pin = GPIO_4_Pin|GPIO_7_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = GPIO_5_Pin|M1_ENC_Z_Pin;
|
||||
GPIO_InitStruct.Pin = GPIO_6_Pin|GPIO_8_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
@@ -0,0 +1,375 @@
|
||||
|
||||
ADC_HandleTypeDef hadc1;
|
||||
ADC_HandleTypeDef hadc2;
|
||||
ADC_HandleTypeDef hadc3;
|
||||
|
||||
/* ADC1 init function */
|
||||
void MX_ADC1_Init(void)
|
||||
{
|
||||
ADC_ChannelConfTypeDef sConfig;
|
||||
ADC_InjectionConfTypeDef sConfigInjected;
|
||||
|
||||
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
||||
*/
|
||||
hadc1.Instance = ADC1;
|
||||
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
|
||||
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc1.Init.ScanConvMode = DISABLE;
|
||||
hadc1.Init.ContinuousConvMode = DISABLE;
|
||||
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc1.Init.NbrOfConversion = 1;
|
||||
hadc1.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_6;
|
||||
sConfig.Rank = 1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time
|
||||
*/
|
||||
sConfigInjected.InjectedChannel = ADC_CHANNEL_6;
|
||||
sConfigInjected.InjectedRank = 1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 1;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
sConfigInjected.ExternalTrigInjecConvEdge = ADC_EXTERNALTRIGINJECCONVEDGE_RISING;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T1_TRGO;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
sConfigInjected.InjectedOffset = 0;
|
||||
if (HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
}
|
||||
/* ADC2 init function */
|
||||
void MX_ADC2_Init(void)
|
||||
{
|
||||
ADC_ChannelConfTypeDef sConfig;
|
||||
ADC_InjectionConfTypeDef sConfigInjected;
|
||||
|
||||
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
||||
*/
|
||||
hadc2.Instance = ADC2;
|
||||
hadc2.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
|
||||
hadc2.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc2.Init.ScanConvMode = DISABLE;
|
||||
hadc2.Init.ContinuousConvMode = DISABLE;
|
||||
hadc2.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
|
||||
hadc2.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T8_TRGO;
|
||||
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc2.Init.NbrOfConversion = 1;
|
||||
hadc2.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
if (HAL_ADC_Init(&hadc2) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_13;
|
||||
sConfig.Rank = 1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time
|
||||
*/
|
||||
sConfigInjected.InjectedChannel = ADC_CHANNEL_10;
|
||||
sConfigInjected.InjectedRank = 1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 1;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
sConfigInjected.ExternalTrigInjecConvEdge = ADC_EXTERNALTRIGINJECCONVEDGE_RISING;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T1_TRGO;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
sConfigInjected.InjectedOffset = 0;
|
||||
if (HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
}
|
||||
/* ADC3 init function */
|
||||
void MX_ADC3_Init(void)
|
||||
{
|
||||
ADC_ChannelConfTypeDef sConfig;
|
||||
ADC_InjectionConfTypeDef sConfigInjected;
|
||||
|
||||
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
||||
*/
|
||||
hadc3.Instance = ADC3;
|
||||
hadc3.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
|
||||
hadc3.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc3.Init.ScanConvMode = DISABLE;
|
||||
hadc3.Init.ContinuousConvMode = DISABLE;
|
||||
hadc3.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
|
||||
hadc3.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T8_TRGO;
|
||||
hadc3.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc3.Init.NbrOfConversion = 1;
|
||||
hadc3.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
if (HAL_ADC_Init(&hadc3) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_12;
|
||||
sConfig.Rank = 1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
/**Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time
|
||||
*/
|
||||
sConfigInjected.InjectedChannel = ADC_CHANNEL_11;
|
||||
sConfigInjected.InjectedRank = 1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 1;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_3CYCLES;
|
||||
sConfigInjected.ExternalTrigInjecConvEdge = ADC_EXTERNALTRIGINJECCONVEDGE_RISING;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T1_TRGO;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
sConfigInjected.InjectedOffset = 0;
|
||||
if (HAL_ADCEx_InjectedConfigChannel(&hadc3, &sConfigInjected) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
if(adcHandle->Instance==ADC1)
|
||||
{
|
||||
/* USER CODE BEGIN ADC1_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC1_MspInit 0 */
|
||||
/* ADC1 clock enable */
|
||||
__HAL_RCC_ADC1_CLK_ENABLE();
|
||||
|
||||
/**ADC1 GPIO Configuration
|
||||
PC0 ------> ADC1_IN10
|
||||
PC1 ------> ADC1_IN11
|
||||
PC2 ------> ADC1_IN12
|
||||
PC3 ------> ADC1_IN13
|
||||
PA4 ------> ADC1_IN4
|
||||
PA5 ------> ADC1_IN5
|
||||
PA6 ------> ADC1_IN6
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
*/
|
||||
GPIO_InitStruct.Pin = M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* ADC1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC_IRQn);
|
||||
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC1_MspInit 1 */
|
||||
}
|
||||
else if(adcHandle->Instance==ADC2)
|
||||
{
|
||||
/* USER CODE BEGIN ADC2_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC2_MspInit 0 */
|
||||
/* ADC2 clock enable */
|
||||
__HAL_RCC_ADC2_CLK_ENABLE();
|
||||
|
||||
/**ADC2 GPIO Configuration
|
||||
PC0 ------> ADC2_IN10
|
||||
PC1 ------> ADC2_IN11
|
||||
PC2 ------> ADC2_IN12
|
||||
PC3 ------> ADC2_IN13
|
||||
PA4 ------> ADC2_IN4
|
||||
PA5 ------> ADC2_IN5
|
||||
PA6 ------> ADC2_IN6
|
||||
PC4 ------> ADC2_IN14
|
||||
PC5 ------> ADC2_IN15
|
||||
*/
|
||||
GPIO_InitStruct.Pin = M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* ADC2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC_IRQn);
|
||||
/* USER CODE BEGIN ADC2_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC2_MspInit 1 */
|
||||
}
|
||||
else if(adcHandle->Instance==ADC3)
|
||||
{
|
||||
/* USER CODE BEGIN ADC3_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC3_MspInit 0 */
|
||||
/* ADC3 clock enable */
|
||||
__HAL_RCC_ADC3_CLK_ENABLE();
|
||||
|
||||
/**ADC3 GPIO Configuration
|
||||
PC0 ------> ADC3_IN10
|
||||
PC1 ------> ADC3_IN11
|
||||
PC2 ------> ADC3_IN12
|
||||
PC3 ------> ADC3_IN13
|
||||
*/
|
||||
GPIO_InitStruct.Pin = M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/* ADC3 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC_IRQn);
|
||||
/* USER CODE BEGIN ADC3_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC3_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
||||
{
|
||||
|
||||
if(adcHandle->Instance==ADC1)
|
||||
{
|
||||
/* USER CODE BEGIN ADC1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ADC1_CLK_DISABLE();
|
||||
|
||||
/**ADC1 GPIO Configuration
|
||||
PC0 ------> ADC1_IN10
|
||||
PC1 ------> ADC1_IN11
|
||||
PC2 ------> ADC1_IN12
|
||||
PC3 ------> ADC1_IN13
|
||||
PA4 ------> ADC1_IN4
|
||||
PA5 ------> ADC1_IN5
|
||||
PA6 ------> ADC1_IN6
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin);
|
||||
|
||||
/* ADC1 interrupt Deinit */
|
||||
/* USER CODE BEGIN ADC1:ADC_IRQn disable */
|
||||
/**
|
||||
* Uncomment the line below to disable the "ADC_IRQn" interrupt
|
||||
* Be aware, disabling shared interrupt may affect other IPs
|
||||
*/
|
||||
/* HAL_NVIC_DisableIRQ(ADC_IRQn); */
|
||||
/* USER CODE END ADC1:ADC_IRQn disable */
|
||||
|
||||
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC1_MspDeInit 1 */
|
||||
}
|
||||
else if(adcHandle->Instance==ADC2)
|
||||
{
|
||||
/* USER CODE BEGIN ADC2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ADC2_CLK_DISABLE();
|
||||
|
||||
/**ADC2 GPIO Configuration
|
||||
PC0 ------> ADC2_IN10
|
||||
PC1 ------> ADC2_IN11
|
||||
PC2 ------> ADC2_IN12
|
||||
PC3 ------> ADC2_IN13
|
||||
PA4 ------> ADC2_IN4
|
||||
PA5 ------> ADC2_IN5
|
||||
PA6 ------> ADC2_IN6
|
||||
PC4 ------> ADC2_IN14
|
||||
PC5 ------> ADC2_IN15
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin
|
||||
|AUX_TEMP_Pin|M0_TEMP_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, M1_TEMP_Pin|AUX_I_Pin|VBUS_S_Pin);
|
||||
|
||||
/* ADC2 interrupt Deinit */
|
||||
/* USER CODE BEGIN ADC2:ADC_IRQn disable */
|
||||
/**
|
||||
* Uncomment the line below to disable the "ADC_IRQn" interrupt
|
||||
* Be aware, disabling shared interrupt may affect other IPs
|
||||
*/
|
||||
/* HAL_NVIC_DisableIRQ(ADC_IRQn); */
|
||||
/* USER CODE END ADC2:ADC_IRQn disable */
|
||||
|
||||
/* USER CODE BEGIN ADC2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC2_MspDeInit 1 */
|
||||
}
|
||||
else if(adcHandle->Instance==ADC3)
|
||||
{
|
||||
/* USER CODE BEGIN ADC3_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ADC3_CLK_DISABLE();
|
||||
|
||||
/**ADC3 GPIO Configuration
|
||||
PC0 ------> ADC3_IN10
|
||||
PC1 ------> ADC3_IN11
|
||||
PC2 ------> ADC3_IN12
|
||||
PC3 ------> ADC3_IN13
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, M0_IB_Pin|M0_IC_Pin|M1_IC_Pin|M1_IB_Pin);
|
||||
|
||||
/* ADC3 interrupt Deinit */
|
||||
/* USER CODE BEGIN ADC3:ADC_IRQn disable */
|
||||
/**
|
||||
* Uncomment the line below to disable the "ADC_IRQn" interrupt
|
||||
* Be aware, disabling shared interrupt may affect other IPs
|
||||
*/
|
||||
/* HAL_NVIC_DisableIRQ(ADC_IRQn); */
|
||||
/* USER CODE END ADC3:ADC_IRQn disable */
|
||||
|
||||
/* USER CODE BEGIN ADC3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC3_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/** Configure pins as
|
||||
* Analog
|
||||
* Input
|
||||
* Output
|
||||
* EVENT_OUT
|
||||
* EXTI
|
||||
*/
|
||||
void MX_GPIO_Init(void)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, M0_nCS_Pin|M1_nCS_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, M1_DC_CAL_Pin|M0_DC_CAL_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(EN_GATE_GPIO_Port, EN_GATE_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : PCPin PCPin PCPin PCPin */
|
||||
GPIO_InitStruct.Pin = M0_nCS_Pin|M1_nCS_Pin|M1_DC_CAL_Pin|M0_DC_CAL_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = GPIO_3_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
HAL_GPIO_Init(GPIO_3_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = GPIO_4_Pin|M0_ENC_Z_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = GPIO_5_Pin|M1_ENC_Z_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = EN_GATE_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(EN_GATE_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = nFAULT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(nFAULT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* EXTI interrupt init*/
|
||||
HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
|
||||
|
||||
}
|
||||
+1
-1
@@ -30,7 +30,7 @@ In this section we will set the compile-time parameters, later we will also set
|
||||
|
||||
To customize the compile time parameters, copy or rename the file `Firmware/tup.config.default` to `Firmware/tup.config` and edit the parameters in that file:
|
||||
|
||||
__CONFIG_BOARD_VERSION__: The board version you're using. Can be `v3.1`, `v3.2`, `v3.3`, `v3.4-24V` or `v3.4-48V`. Check for a label on the upper side of the ODrive to find out which version you have.
|
||||
__CONFIG_BOARD_VERSION__: The board version you're using. Can be `v3.1`, `v3.2`, `v3.3`, `v3.4-24V`, `v3.4-48V`, `v3.5-24V` or `v3.5-48V`. Check for a label on the upper side of the ODrive to find out which version you have.
|
||||
|
||||
__CONFIG_USB_PROTOCOL__: Defines which protocol the ODrive should use on the USB interface.
|
||||
* `native`: The native ODrive protocol. Use this if you want to use the python tools in this repo.
|
||||
|
||||
@@ -23,6 +23,14 @@ elseif boardversion == "v3.4-48V" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=4"
|
||||
FLAGS += "-DHW_VERSION_VOLTAGE=48"
|
||||
elseif boardversion == "v3.5-24V" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=5"
|
||||
FLAGS += "-DHW_VERSION_VOLTAGE=24"
|
||||
elseif boardversion == "v3.5-48V" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=5"
|
||||
FLAGS += "-DHW_VERSION_VOLTAGE=48"
|
||||
elseif boardversion == "" then
|
||||
error("board version not specified - take a look at tup.config.default")
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copy this file to tup.config and adapt it to your needs
|
||||
# make sure this fits your board
|
||||
#CONFIG_BOARD_VERSION=v3.4-24V
|
||||
#CONFIG_BOARD_VERSION=v3.5-24V
|
||||
CONFIG_USB_PROTOCOL=native
|
||||
CONFIG_UART_PROTOCOL=ascii
|
||||
CONFIG_STEP_DIR=n
|
||||
|
||||
Reference in New Issue
Block a user