下载资源后端资源详情
MCSDK_v5.4.8.zip
大小:254.85KB
价格:43积分
下载量:0
评分:
5.0
上传者:qq_21537539
更新日期:2025-09-22

ST MCSDK 电机FOC库(添加中文注释)

资源文件列表(大概)

文件名
大小
MCSDK_v5.4.8/MotorControl/
-
MCSDK_v5.4.8/MotorControl/MCSDK/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/bus_voltage_sensor.h
3.27KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/circle_limitation.h
2.24KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/digital_output.h
3.21KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/enc_align_ctrl.h
4.4KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/encoder_speed_pos_fdbk.h
4.41KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/fast_div.h
2.31KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/feed_forward_ctrl.h
7.27KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/flux_weakening_ctrl.h
7.42KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/gap_gate_driver_ctrl.h
14.33KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/hall_speed_pos_fdbk.h
10.1KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/hifreqinj_fpu_ctrl.h
1.87KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/ics_dd_pwmncurrfdbk.h
5.97KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/inrush_current_limiter.h
3.3KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/max_torque_per_ampere.h
2.18KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/mc_tuning.h
26.86KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/mc_type.h
10.58KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/motor_power_measurement.h
3.8KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/mp_one_touch_tuning.h
12.55KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/mp_self_com_ctrl.h
19.78KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/ntc_temperature_sensor.h
4.88KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/open_loop.h
3.58KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/pid_regulator.h
8.35KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/pqd_motor_power_measurement.h
2.77KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/pwm_common.h
2.49KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/pwm_curr_fdbk.h
14.95KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/r_divider_bus_voltage_sensor.h
3.88KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/r1_dd_pwm_curr_fdbk.h
5.89KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/ramp_ext_mngr.h
3.13KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/revup_ctrl.h
8.62KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/speed_pos_fdbk.h
4.77KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/speed_torq_ctrl.h
8.66KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/state_machine.h
9.14KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/sto_cordic_speed_pos_fdbk.h
14.11KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/sto_pll_speed_pos_fdbk.h
14.65KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/sto_speed_pos_fdbk.h
2.5KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/trajectory_ctrl.h
4.18KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/virtual_bus_voltage_sensor.h
2.41KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Inc/virtual_speed_sensor.h
6.04KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/bus_voltage_sensor.c
3.34KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/circle_limitation.c
4.34KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/digital_output.c
2.46KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/enc_align_ctrl.c
5.27KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/encoder_speed_pos_fdbk.c
12.28KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/fast_div.c
7.16KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/feed_forward_ctrl.c
11.88KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/flux_weakening_ctrl.c
10.89KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/gap_gate_driver_ctrl.c
24.73KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/hall_speed_pos_fdbk.c
25.85KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/hifreqinj_fpu_ctrl.c
33.23KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/inrush_current_limiter.c
5.21KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/max_torque_per_ampere.c
5.25KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/motor_power_measurement.c
4.02KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/ntc_temperature_sensor.c
6.44KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/open_loop.c
3.42KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/pid_regulator.c
14KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/pqd_motor_power_measurement.c
2.79KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/pwm_common.c
5.68KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/pwm_curr_fdbk.c
19.5KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/r_divider_bus_voltage_sensor.c
5.8KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/ramp_ext_mngr.c
8.02KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/revup_ctrl.c
21.81KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/speed_pos_fdbk.c
10.43KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/speed_torq_ctrl.c
16.82KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/state_machine.c
10.25KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/sto_cordic_speed_pos_fdbk.c
34.41KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/sto_pll_speed_pos_fdbk.c
35.25KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/trajectory_ctrl.c
14.49KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/virtual_bus_voltage_sensor.c
2.41KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/Any/Src/virtual_speed_sensor.c
16.09KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Inc/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Inc/ics_g4xx_pwm_curr_fdbk.h
8.03KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Inc/r1_g4xx_pwm_curr_fdbk.h
10.89KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Inc/r3_2_g4xx_pwm_curr_fdbk.h
13.5KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Inc/r3_3_g4xx_pwm_curr_fdbk.h
18.32KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Src/
-
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Src/ics_g4xx_pwm_curr_fdbk.c
25.25KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Src/r1_g4xx_pwm_curr_fdbk.c
45.83KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Src/r3_2_g4xx_pwm_curr_fdbk.c
55.33KB
MCSDK_v5.4.8/MotorControl/MCSDK/MCLib/G4xx/Src/r3_3_g4xx_pwm_curr_fdbk.c
53.95KB
MCSDK_v5.4.8/MotorControl/MCSDK/SystemDriveParams/
-
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/
-
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/
-
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/dac_common_ui.h
2.82KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/dac_rctimer_ui.h
1.61KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/dac_ui.h
1.67KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/frame_communication_protocol.h
7.07KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/ui_irq_handler.h
4.71KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/UIIRQHandlerClass.h
930B
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/UIIRQHandlerPrivate.h
1.21KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/unidirectional_fast_com.h
3.48KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Inc/usart_frame_communication_protocol.h
2.83KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/
-
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/dac_common_ui.c
4.16KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/frame_communication_protocol.c
3.58KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/ui_irq_handler.c
5.04KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/unidirectional_fast_com.c
4.68KB
MCSDK_v5.4.8/MotorControl/MCSDK/UILibrary/Src/usart_frame_communication_protocol.c
8.43KB

资源内容介绍

自己看ST的FOC库时,添加了一些代码注释,可以辅助理解代码
/** ****************************************************************************** * @file r3_2_g4xx_pwm_curr_fdbk.c * @author Motor Control SDK Team, ST Microelectronics * @brief This file provides firmware functions that implement current sensor * class to be stantiated when the three shunts current sensing * topology is used. It is specifically designed for STM32F30X * microcontrollers and implements the successive sampling of two motor * current using shared ADC. * + MCU peripheral and handle initialization function * + three shunts current sensing * + space vector modulation function * + ADC sampling function * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under Ultimate Liberty license * SLA0044, the "License"; You may not use this file except in compliance with * the License. You may obtain a copy of the License at: * www.st.com/SLA0044 * ****************************************************************************** */#include "r3_2_g4xx_pwm_curr_fdbk.h"#include "pwm_common.h"#include "mc_type.h"/** @addtogroup MCSDK * @{ *//** @addtogroup pwm_curr_fdbk * @{ *//** * @defgroup R3_2_G4XX_pwm_curr_fdbk R3 2 ADCs G4 PWM & Current Feedback * * @brief STM32G4, Shared Resources, 3-Shunt PWM & Current Feedback implementation * * This component is used in applications based on an STM32G4 MCU, using a three * shunt resistors current sensing topology and 2 ADC peripherals to acquire the current * values. * * * @todo: TODO: complete documentation. * * @{ */#define TIMxCCER_MASK_CH123 ((uint16_t) (LL_TIM_CHANNEL_CH1|LL_TIM_CHANNEL_CH1N|\ LL_TIM_CHANNEL_CH2|LL_TIM_CHANNEL_CH2N|\ LL_TIM_CHANNEL_CH3|LL_TIM_CHANNEL_CH3N))static void R3_2_TIMxInit( TIM_TypeDef * TIMx, PWMC_Handle_t * pHdl );static void R3_2_ADCxInit( ADC_TypeDef * ADCx );__STATIC_INLINE uint16_t R3_2_WriteTIMRegisters( PWMC_Handle_t * pHdl, uint16_t hCCR4Reg );static void R3_2_HFCurrentsPolarizationAB( PWMC_Handle_t * pHdl,ab_t * Iab );static void R3_2_HFCurrentsPolarizationC( PWMC_Handle_t * pHdl, ab_t * Iab );static void R3_2_SetAOReferenceVoltage( uint32_t DAC_Channel, DAC_TypeDef * DACx, uint16_t hDACVref );uint16_t R3_2_SetADCSampPointPolarization( PWMC_Handle_t * pHdl) ;static void R3_2_RLGetPhaseCurrents( PWMC_Handle_t * pHdl, ab_t * pStator_Currents );static void R3_2_RLTurnOnLowSides( PWMC_Handle_t * pHdl );static void R3_2_RLSwitchOnPWM( PWMC_Handle_t * pHdl );/** * @brief It initializes TIMx, ADC, GPIO, DMA1 and NVIC for current reading * in three shunt topology using STM32F30X and shared ADC * @param pHandle: handler of the current instance of the PWM component * @retval none */__weak void R3_2_Init( PWMC_R3_2_Handle_t * pHandle ){ R3_3_OPAMPParams_t * OPAMPParams = pHandle->pParams_str->OPAMPParams; COMP_TypeDef * COMP_OCPAx = pHandle->pParams_str->CompOCPASelection; COMP_TypeDef * COMP_OCPBx = pHandle->pParams_str->CompOCPBSelection; COMP_TypeDef * COMP_OCPCx = pHandle->pParams_str->CompOCPCSelection; COMP_TypeDef * COMP_OVPx = pHandle->pParams_str->CompOVPSelection; DAC_TypeDef * DAC_OCPAx = pHandle->pParams_str->DAC_OCP_ASelection; DAC_TypeDef * DAC_OCPBx = pHandle->pParams_str->DAC_OCP_BSelection; DAC_TypeDef * DAC_OCPCx = pHandle->pParams_str->DAC_OCP_CSelection; DAC_TypeDef * DAC_OVPx = pHandle->pParams_str->DAC_OVP_Selection; TIM_TypeDef * TIMx = pHandle->pParams_str->TIMx; ADC_TypeDef * ADCx_1 = pHandle->pParams_str->ADCx_1; ADC_TypeDef * ADCx_2 = pHandle->pParams_str->ADCx_2; if ( ( uint32_t )pHandle == ( uint32_t )&pHandle->_Super ) { /* disable IT and flags in case of LL driver usage * workaround for unwanted interrupt enabling done by LL driver清除和关闭不需要的ADC中断*/ LL_ADC_DisableIT_EOC( ADCx_1 ); LL_ADC_ClearFlag_EOC( ADCx_1 ); LL_ADC_DisableIT_JEOC( ADCx_1 ); LL_ADC_ClearFlag_JEOC( ADCx_1 ); LL_ADC_DisableIT_EOC( ADCx_2 ); LL_ADC_ClearFlag_EOC( ADCx_2 ); LL_ADC_DisableIT_JEOC( ADCx_2 ); LL_ADC_ClearFlag_JEOC( ADCx_2 ); if ( TIMx == TIM1 ) { LL_DBGMCU_APB2_GRP1_FreezePeriph( LL_DBGMCU_APB2_GRP1_TIM1_STOP ); } else { LL_DBGMCU_APB2_GRP1_FreezePeriph( LL_DBGMCU_APB2_GRP1_TIM8_STOP ); } if ( OPAMPParams != NULL ) {//内部运放,未使用 if (OPAMPParams -> OPAMPx_1 != NULL ) { LL_OPAMP_Enable( OPAMPParams->OPAMPx_1 ); } if (OPAMPParams -> OPAMPx_2 != NULL ) { LL_OPAMP_Enable( OPAMPParams->OPAMPx_2 ); } if (OPAMPParams -> OPAMPx_3 != NULL ) { LL_OPAMP_Enable( OPAMPParams->OPAMPx_3 ); } } if ( COMP_OCPAx != NULL ) { if (( pHandle->pParams_str->CompOCPAInvInput_MODE != EXT_MODE ) && (DAC_OCPAx != MC_NULL)) { R3_2_SetAOReferenceVoltage( pHandle->pParams_str->DAC_Channel_OCPA, DAC_OCPAx, ( uint16_t )( pHandle->pParams_str->DAC_OCP_Threshold ) ); } LL_COMP_Enable ( COMP_OCPAx ); LL_COMP_Lock( COMP_OCPAx ); } if ( COMP_OCPBx != NULL ) { if (( pHandle->pParams_str->CompOCPBInvInput_MODE != EXT_MODE ) && (DAC_OCPBx != MC_NULL)) { R3_2_SetAOReferenceVoltage( pHandle->pParams_str->DAC_Channel_OCPB, DAC_OCPBx,( uint16_t )( pHandle->pParams_str->DAC_OCP_Threshold ) ); } LL_COMP_Enable ( COMP_OCPBx ); LL_COMP_Lock( COMP_OCPBx ); } if ( COMP_OCPCx != NULL ) { if (( pHandle->pParams_str->CompOCPCInvInput_MODE != EXT_MODE ) && (DAC_OCPCx != MC_NULL)) { R3_2_SetAOReferenceVoltage( pHandle->pParams_str->DAC_Channel_OCPC, DAC_OCPCx,( uint16_t )( pHandle->pParams_str->DAC_OCP_Threshold ) ); } LL_COMP_Enable ( COMP_OCPCx ); LL_COMP_Lock( COMP_OCPCx ); } if ( COMP_OVPx != NULL ) { if (( pHandle->pParams_str->CompOVPInvInput_MODE != EXT_MODE ) && (DAC_OVPx != MC_NULL)) { R3_2_SetAOReferenceVoltage( pHandle->pParams_str->DAC_Channel_OVP, DAC_OVPx,( uint16_t )( pHandle->pParams_str->DAC_OVP_Threshold ) ); } LL_COMP_Enable ( COMP_OVPx ); LL_COMP_Lock( COMP_OVPx ); } if (LL_ADC_IsEnabled (ADCx_1) == 0) { R3_2_ADCxInit (ADCx_1); /* Only the Interrupt of the first ADC is enabled. * As Both ADCs are fired by HW at the same moment * It is safe to consider that both conversion are ready at the same

用户评论 (0)

发表评论

captcha