X-CUBE-SPN11 for X-NUCLEO-IHM11M1
|
This file provides the interface between the MC-lib and STM Nucleo. More...
Go to the source code of this file.
Macros | |
#define | HF_TIMx htim1 |
#define | LF_TIMx htim4 |
#define | HALL_ENCODER_TIMx htim2 |
#define | ADCx hadc1 |
#define | DACx htim3 |
#define | UART huart2 |
#define | ADC_CH_1 ADC_CHANNEL_0 /*CURRENT*/ |
#define | ADC_CH_2 ADC_CHANNEL_12 /*SPEED*/ |
#define | ADC_CH_3 ADC_CHANNEL_1 /*VBUS*/ |
#define | ADC_CH_4 ADC_CHANNEL_2 /*TEMP */ |
#define | ADC_Bemf_CH1 ADC_CHANNEL_13 /*BEMF1*/ |
#define | ADC_Bemf_CH2 ADC_CHANNEL_8 /*BEMF2*/ |
#define | ADC_Bemf_CH3 ADC_CHANNEL_7 /*BEMF3*/ |
#define | ADC_CH_1_ST ADC_SAMPLETIME_3CYCLES /*CURRENT sampling time */ |
#define | ADC_CH_2_ST ADC_SAMPLETIME_84CYCLES /*SPEED sampling time*/ |
#define | ADC_CH_3_ST ADC_SAMPLETIME_84CYCLES /*VBUS sampling time*/ |
#define | ADC_CH_4_ST ADC_SAMPLETIME_84CYCLES /*TEMP sampling time*/ |
#define | ADC_Bemf_CH1_ST ADC_SAMPLETIME_28CYCLES /*BEMF1 sampling time*/ |
#define | ADC_Bemf_CH2_ST ADC_SAMPLETIME_28CYCLES /*BEMF2 sampling time*/ |
#define | ADC_Bemf_CH3_ST ADC_SAMPLETIME_28CYCLES /*BEMF3 sampling time*/ |
#define | HF_TIMx_CH1 TIM_CHANNEL_1 |
#define | HF_TIMx_CH2 TIM_CHANNEL_2 |
#define | HF_TIMx_CH3 TIM_CHANNEL_3 |
#define | HF_TIMx_CCR1 CCR1 /*Channel 1*/ |
#define | HF_TIMx_CCR2 CCR2 /*Channel 2*/ |
#define | HF_TIMx_CCR3 CCR3 /*Channel 3*/ |
#define | DAC_ENABLE 0 |
#define | GPIO_PORT_ZCR GPIOC |
#define | GPIO_CH_ZCR GPIO_PIN_12 |
#define | GPIO_PORT_COMM GPIOC |
#define | GPIO_CH_COMM GPIO_PIN_10 |
#define | STARTM_CMD 0 |
#define | STOPMT_CMD 1 |
#define | SETSPD_CMD 2 |
#define | GETSPD_CMD 3 |
#define | INIREF_CMD 4 |
#define | POLESP_CMD 5 |
#define | ACCELE_CMD 6 |
#define | KP_PRM_CMD 7 |
#define | KI_PRM_CMD 8 |
#define | POTENZ_CMD 9 |
#define | HELP_CMD 10 |
#define | STATUS_CMD 11 |
#define | DIRECT_CMD 12 |
Functions | |
void | MC_SixStep_ADC_Channel (uint32_t) |
API function for STM32 instruction. More... | |
void | MC_SixStep_Nucleo_Init (void) |
Init the STM32 register. More... | |
void | START_Ref_Generation (void) |
void | STOP_Ref_Generation (void) |
void | Set_Ref_Generation (uint16_t) |
void | START_DAC (void) |
Start DAC for debug. More... | |
void | STOP_DAC (void) |
Stop DAC for debug. More... | |
void | SET_DAC_value (uint16_t) |
Set DAC value for debug. More... | |
void | Bemf_delay_calc (void) |
Bemf delay calculation. More... | |
uint32_t | Get_UART_Data (void) |
Get the UART value from DR register. More... | |
void | MC_SixStep_EnableInput_CH1_E_CH2_E_CH3_D (void) |
Enable Input channel CH1 and CH2 for STSPIN230. More... | |
void | MC_SixStep_EnableInput_CH1_E_CH2_D_CH3_E (void) |
Enable Input channel CH1 and CH3 for STSPIN230. More... | |
void | MC_SixStep_EnableInput_CH1_D_CH2_E_CH3_E (void) |
Enable Input channel CH2 and CH3 for STSPIN230. More... | |
void | MC_SixStep_DisableInput_CH1_D_CH2_D_CH3_D (void) |
Enable Input channel CH2 and CH3 for STSPIN230. More... | |
void | MC_SixStep_Start_PWM_driving (void) |
Enable PWM channels for STSPIN230. More... | |
void | MC_SixStep_Stop_PWM_driving (void) |
Disable PWM channels for STSPIN230. More... | |
void | MC_SixStep_HF_TIMx_SetDutyCycle_CH1 (uint16_t) |
Set the Duty Cycle value for CH1. More... | |
void | MC_SixStep_HF_TIMx_SetDutyCycle_CH2 (uint16_t) |
Set the Duty Cycle value for CH2. More... | |
void | MC_SixStep_HF_TIMx_SetDutyCycle_CH3 (uint16_t) |
Set the Duty Cycle value for CH3. More... | |
void | MC_SixStep_Current_Reference_Start (void) |
Enable the Current Reference generation. More... | |
void | MC_SixStep_Current_Reference_Stop (void) |
Disable the Current Reference generation. More... | |
void | MC_SixStep_Current_Reference_Setvalue (uint16_t) |
Set the value for Current Reference. More... | |
void | BSP_X_NUCLEO_FAULT_LED_ON (void) |
void | BSP_X_NUCLEO_FAULT_LED_OFF (void) |
Detailed Description
This file provides the interface between the MC-lib and STM Nucleo.
- Author
- IPC
- Version
- V0
- Date
- 10/08/2016
- Attention
© COPYRIGHT(c) 2015 STMicroelectronics
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file stm32F401_nucleo_ihm11m1.h.
Macro Definition Documentation
#define ACCELE_CMD 6 |
Set the Accelleration for Start-up of the motor command received
Definition at line 88 of file stm32F401_nucleo_ihm11m1.h.
#define ADC_Bemf_CH1 ADC_CHANNEL_13 /*BEMF1*/ |
Definition at line 56 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_Bemf_CH1_ST ADC_SAMPLETIME_28CYCLES /*BEMF1 sampling time*/ |
Definition at line 64 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_Bemf_CH2 ADC_CHANNEL_8 /*BEMF2*/ |
Definition at line 57 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_Bemf_CH2_ST ADC_SAMPLETIME_28CYCLES /*BEMF2 sampling time*/ |
Definition at line 65 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_Bemf_CH3 ADC_CHANNEL_7 /*BEMF3*/ |
Definition at line 58 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_Bemf_CH3_ST ADC_SAMPLETIME_28CYCLES /*BEMF3 sampling time*/ |
Definition at line 66 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_CH_1 ADC_CHANNEL_0 /*CURRENT*/ |
Definition at line 52 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_CH_1_ST ADC_SAMPLETIME_3CYCLES /*CURRENT sampling time */ |
Definition at line 60 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_CH_2 ADC_CHANNEL_12 /*SPEED*/ |
Definition at line 53 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_CH_2_ST ADC_SAMPLETIME_84CYCLES /*SPEED sampling time*/ |
Definition at line 61 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_CH_3 ADC_CHANNEL_1 /*VBUS*/ |
Definition at line 54 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_CH_3_ST ADC_SAMPLETIME_84CYCLES /*VBUS sampling time*/ |
Definition at line 62 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADC_CH_4 ADC_CHANNEL_2 /*TEMP */ |
Definition at line 55 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), and MC_SixStep_RESET().
#define ADC_CH_4_ST ADC_SAMPLETIME_84CYCLES /*TEMP sampling time*/ |
Definition at line 63 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init().
#define ADCx hadc1 |
Definition at line 48 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_ADCx_SixStep_Bemf(), MC_SixStep_ADC_Channel(), MC_StartMotor(), and MC_StopMotor().
#define DAC_ENABLE 0 |
Enable (1) the DAC peripheral
Definition at line 75 of file stm32F401_nucleo_ihm11m1.h.
#define DACx htim3 |
Definition at line 49 of file stm32F401_nucleo_ihm11m1.h.
#define DIRECT_CMD 12 |
Get the motor direction
Definition at line 94 of file stm32F401_nucleo_ihm11m1.h.
#define GETSPD_CMD 3 |
Get Mechanical Motor Speed command received
Definition at line 85 of file stm32F401_nucleo_ihm11m1.h.
#define GPIO_CH_COMM GPIO_PIN_10 |
GPIO pin name for 6Step commutation
Definition at line 80 of file stm32F401_nucleo_ihm11m1.h.
Referenced by HAL_MspInit(), MC_ADCx_SixStep_Bemf(), and MC_SixStep_TABLE().
#define GPIO_CH_ZCR GPIO_PIN_12 |
GPIO pin name for zero crossing detection
Definition at line 78 of file stm32F401_nucleo_ihm11m1.h.
Referenced by HAL_MspInit(), and MC_SixStep_ARR_Bemf().
#define GPIO_PORT_COMM GPIOC |
GPIO port name for 6Step commutation
Definition at line 79 of file stm32F401_nucleo_ihm11m1.h.
Referenced by HAL_MspInit(), MC_ADCx_SixStep_Bemf(), and MC_SixStep_TABLE().
#define GPIO_PORT_ZCR GPIOC |
GPIO port name for zero crossing detection
Definition at line 77 of file stm32F401_nucleo_ihm11m1.h.
Referenced by HAL_MspInit(), and MC_SixStep_ARR_Bemf().
#define HALL_ENCODER_TIMx htim2 |
Definition at line 47 of file stm32F401_nucleo_ihm11m1.h.
#define HELP_CMD 10 |
Help command received
Definition at line 92 of file stm32F401_nucleo_ihm11m1.h.
#define HF_TIMx htim1 |
Definition at line 45 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_ADCx_SixStep_Bemf(), MC_SixStep_INIT(), MC_SixStep_NEXT_step(), MC_SixStep_Nucleo_Init(), MC_SixStep_RESET(), MC_StopMotor(), STSPIN230_DisableInput_CH1_D_CH2_D_CH3_D(), STSPIN230_EnableInput_CH1_D_CH2_E_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_D_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_E_CH3_D(), STSPIN230_HF_TIMx_SetDutyCycle_CH1(), STSPIN230_HF_TIMx_SetDutyCycle_CH2(), STSPIN230_HF_TIMx_SetDutyCycle_CH3(), STSPIN230_Start_PWM_driving(), and STSPIN230_Stop_PWM_driving().
#define HF_TIMx_CCR1 CCR1 /*Channel 1*/ |
Definition at line 71 of file stm32F401_nucleo_ihm11m1.h.
#define HF_TIMx_CCR2 CCR2 /*Channel 2*/ |
Definition at line 72 of file stm32F401_nucleo_ihm11m1.h.
#define HF_TIMx_CCR3 CCR3 /*Channel 3*/ |
Definition at line 73 of file stm32F401_nucleo_ihm11m1.h.
#define HF_TIMx_CH1 TIM_CHANNEL_1 |
Definition at line 68 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), STSPIN230_DisableInput_CH1_D_CH2_D_CH3_D(), STSPIN230_EnableInput_CH1_D_CH2_E_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_D_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_E_CH3_D(), STSPIN230_Start_PWM_driving(), and STSPIN230_Stop_PWM_driving().
#define HF_TIMx_CH2 TIM_CHANNEL_2 |
Definition at line 69 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), STSPIN230_DisableInput_CH1_D_CH2_D_CH3_D(), STSPIN230_EnableInput_CH1_D_CH2_E_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_D_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_E_CH3_D(), STSPIN230_Start_PWM_driving(), and STSPIN230_Stop_PWM_driving().
#define HF_TIMx_CH3 TIM_CHANNEL_3 |
Definition at line 70 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_SixStep_Nucleo_Init(), STSPIN230_DisableInput_CH1_D_CH2_D_CH3_D(), STSPIN230_EnableInput_CH1_D_CH2_E_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_D_CH3_E(), STSPIN230_EnableInput_CH1_E_CH2_E_CH3_D(), STSPIN230_Start_PWM_driving(), and STSPIN230_Stop_PWM_driving().
#define INIREF_CMD 4 |
Set the new STARUP_CURRENT_REFERENCE value command received
Definition at line 86 of file stm32F401_nucleo_ihm11m1.h.
#define KI_PRM_CMD 8 |
Set the KI PI param command received
Definition at line 90 of file stm32F401_nucleo_ihm11m1.h.
#define KP_PRM_CMD 7 |
Set the KP PI param command received
Definition at line 89 of file stm32F401_nucleo_ihm11m1.h.
#define LF_TIMx htim4 |
Definition at line 46 of file stm32F401_nucleo_ihm11m1.h.
Referenced by MC_GetElSpeedHz(), MC_SixStep_Alignment(), MC_SixStep_ARR_Bemf(), MC_SixStep_ARR_step(), MC_SixStep_INIT(), MC_SixStep_NEXT_step(), MC_SixStep_RESET(), MC_StartMotor(), and MC_StopMotor().
#define POLESP_CMD 5 |
Set the Pole Pairs value command received
Definition at line 87 of file stm32F401_nucleo_ihm11m1.h.
#define POTENZ_CMD 9 |
Enable Potentiometer command received
Definition at line 91 of file stm32F401_nucleo_ihm11m1.h.
#define SETSPD_CMD 2 |
Set the new speed value command received
Definition at line 84 of file stm32F401_nucleo_ihm11m1.h.
#define STARTM_CMD 0 |
Start Motor command received
Definition at line 82 of file stm32F401_nucleo_ihm11m1.h.
#define STATUS_CMD 11 |
Get the Status of the system command received
Definition at line 93 of file stm32F401_nucleo_ihm11m1.h.
#define STOPMT_CMD 1 |
Stop Motor command received
Definition at line 83 of file stm32F401_nucleo_ihm11m1.h.
#define UART huart2 |
Definition at line 50 of file stm32F401_nucleo_ihm11m1.h.
Referenced by Get_UART_Data().
Generated by 1.8.11