X-CUBE-SPN7 for X-NUCLEO-IHM07M1: C:/Users/giuseppe scuderi-sl/Desktop/MOTOR CONTROL/Peppe/trunk/Firmware/X-CUBE-SPN7-MC-6STEP/Middlewares/ST/MC_6Step_Lib/Inc/6Step_Lib.h Source File

X-NUCLEO-IHM07M1 X-CUBE-SPN7

6Step_Lib.h
Go to the documentation of this file.
1 
40 /* Define to prevent recursive inclusion -------------------------------------*/
41 #ifndef __6STEP_LIB_H
42 #define __6STEP_LIB_H
43 
44 #include "stm32_nucleo_ihm07m1.h"
45 
46 #include "math.h"
47 #include "stdlib.h"
48 #include "stdio.h"
49 
67 typedef enum
68 {
69  IDLE, /* 0 */
70  STARTUP, /* 1 */
71  VALIDATION, /* 2 */
72  STOP, /* 3 */
73  START, /* 4 */
74  RUN, /* 5 */
75  ALIGNMENT, /* 6 */
76  SPEEDFBKERROR, /* 7 */
77  OVERCURRENT, /* 8 */
78  STARTUP_FAILURE, /* 9 */
79  STARTUP_BEMF_FAILURE /* 10 */
81 
93 typedef struct
94 {
95  uint32_t LF_TIMx_PSC;
96  uint32_t LF_TIMx_ARR;
97  uint32_t HF_TIMx_PSC;
98  uint32_t HF_TIMx_ARR;
99  uint32_t HF_TIMx_CCR;
100  uint8_t step_position;
102  uint8_t status_prev;
103  uint16_t pulse_value;
104  uint16_t ARR_value;
105  uint32_t Regular_channel[4];
107  uint32_t prescaler_value;
108  uint16_t numberofitemArr;
109  uint32_t ADC_BUFFER[4];
110  uint32_t ADC_SEQ_CHANNEL[4];
111  uint32_t ADC_Regular_Buffer[5];
114  uint16_t demagn_counter;
115  uint16_t demagn_value;
116  int16_t speed_fdbk;
118  int16_t filter_depth;
119  uint16_t Current_Reference;
120  uint16_t Ireference;
122  uint8_t CMD;
123  uint8_t ALIGN_OK;
124  uint8_t ALIGNMENT;
125  uint8_t bemf_state_1;
126  uint8_t bemf_state_2;
127  uint8_t bemf_state_3;
128  uint8_t bemf_state_4;
129  uint8_t bemf_state_5;
130  uint8_t bemf_state_6;
131  uint16_t Speed_Loop_Time;
133  uint16_t RUN_Motor;
134  uint8_t ARR_OK;
135  uint8_t VALIDATION_OK;
136  uint8_t SPEED_VALIDATED;
137  uint16_t Speed_target_ramp;
138  uint16_t Speed_target_time;
139  uint16_t Ramp_Start;
140  uint16_t Bemf_delay_start;
142  uint32_t SYSCLK_frequency;
143  uint32_t Uart_cmd_to_set;
144  uint32_t Uart_value_to_set;
145  uint8_t Button_ready;
146  uint8_t BEMF_OK;
147  uint8_t CL_READY;
149  uint16_t IREFERENCE;
150  uint16_t NUMPOLESPAIRS;
151  uint32_t ACCEL;
152  uint16_t KP;
153  uint16_t KI;
154  uint8_t CW_CCW;
155  uint8_t Potentiometer;
169 typedef struct
170 {
171  int16_t Reference;
172  int16_t Kp_Gain;
173  int16_t Ki_Gain;
176  int8_t Max_PID_Output;
177  int8_t Min_PID_Output;
188 void MC_SixStep_INIT(void);
189 void MC_SixStep_RESET(void);
190 void MC_StartMotor(void);
191 void MC_StopMotor(void);
192 void MC_Set_Speed(uint16_t);
193 void MC_EXT_button_SixStep(void);
194 
208 #endif
uint16_t IREFERENCE
Definition: 6Step_Lib.h:149
Six Step parameters.
Definition: 6Step_Lib.h:93
uint8_t status_prev
Definition: 6Step_Lib.h:102
uint8_t bemf_state_4
Definition: 6Step_Lib.h:128
uint16_t KP
Definition: 6Step_Lib.h:152
uint16_t ADC_BEMF_threshold_UP
Definition: 6Step_Lib.h:112
int8_t Min_PID_Output
Definition: 6Step_Lib.h:177
uint16_t ADC_BEMF_threshold_DOWN
Definition: 6Step_Lib.h:113
uint16_t Ramp_Start
Definition: 6Step_Lib.h:139
uint16_t ARR_value
Definition: 6Step_Lib.h:104
uint16_t Bemf_delay_start
Definition: 6Step_Lib.h:140
uint16_t numberofitemArr
Definition: 6Step_Lib.h:108
uint8_t VALIDATION_OK
Definition: 6Step_Lib.h:135
uint32_t prescaler_value
Definition: 6Step_Lib.h:107
int16_t filter_depth
Definition: 6Step_Lib.h:118
uint32_t LF_TIMx_PSC
Definition: 6Step_Lib.h:95
SIXSTEP_Base_SystStatus_t
Six Step parameters.
Definition: 6Step_Lib.h:67
uint16_t Speed_target_time
Definition: 6Step_Lib.h:138
uint16_t Ireference
Definition: 6Step_Lib.h:120
uint32_t HF_TIMx_CCR
Definition: 6Step_Lib.h:99
uint16_t demagn_value
Definition: 6Step_Lib.h:115
int16_t Ki_Gain
Definition: 6Step_Lib.h:173
uint32_t SYSCLK_frequency
Definition: 6Step_Lib.h:142
struct SIXSTEP_PI_PARAM_InitTypeDef_t * SIXSTEP_pi_PARAM_InitTypeDef_t
int32_t Integral_Term_sum
Definition: 6Step_Lib.h:121
uint8_t CW_CCW
Definition: 6Step_Lib.h:154
uint32_t CurrentRegular_BEMF_ch
Definition: 6Step_Lib.h:106
int16_t speed_fdbk
Definition: 6Step_Lib.h:116
uint16_t KI
Definition: 6Step_Lib.h:153
uint32_t HF_TIMx_PSC
Definition: 6Step_Lib.h:97
uint8_t Potentiometer
Definition: 6Step_Lib.h:155
uint16_t Current_Reference
Definition: 6Step_Lib.h:119
This file provides the interface between the MC-lib and STM Nucleo.
uint8_t SPEED_VALIDATED
Definition: 6Step_Lib.h:136
uint8_t CMD
Definition: 6Step_Lib.h:122
uint16_t Speed_Loop_Time
Definition: 6Step_Lib.h:131
int8_t Max_PID_Output
Definition: 6Step_Lib.h:176
uint16_t pulse_value
Definition: 6Step_Lib.h:103
uint8_t bemf_state_5
Definition: 6Step_Lib.h:129
uint8_t ALIGN_OK
Definition: 6Step_Lib.h:123
uint16_t RUN_Motor
Definition: 6Step_Lib.h:133
uint16_t demagn_counter
Definition: 6Step_Lib.h:114
uint8_t bemf_state_6
Definition: 6Step_Lib.h:130
uint16_t Speed_Ref_filtered
Definition: 6Step_Lib.h:132
uint16_t Speed_target_ramp
Definition: 6Step_Lib.h:137
uint16_t MediumFrequencyTask_flag
Definition: 6Step_Lib.h:141
int16_t Kp_Gain
Definition: 6Step_Lib.h:172
int16_t Upper_Limit_Output
Definition: 6Step_Lib.h:175
uint8_t step_position
Definition: 6Step_Lib.h:100
uint8_t BEMF_Tdown_count
Definition: 6Step_Lib.h:148
Six PI regulator parameters.
Definition: 6Step_Lib.h:169
uint8_t bemf_state_3
Definition: 6Step_Lib.h:127
int16_t Reference
Definition: 6Step_Lib.h:171
uint8_t bemf_state_2
Definition: 6Step_Lib.h:126
uint16_t NUMPOLESPAIRS
Definition: 6Step_Lib.h:150
SIXSTEP_Base_SystStatus_t STATUS
Definition: 6Step_Lib.h:101
uint8_t bemf_state_1
Definition: 6Step_Lib.h:125
uint32_t ACCEL
Definition: 6Step_Lib.h:151
int16_t speed_fdbk_filtered
Definition: 6Step_Lib.h:117
uint8_t ALIGNMENT
Definition: 6Step_Lib.h:124
uint8_t ARR_OK
Definition: 6Step_Lib.h:134
uint32_t HF_TIMx_ARR
Definition: 6Step_Lib.h:98
uint32_t LF_TIMx_ARR
Definition: 6Step_Lib.h:96
int16_t Lower_Limit_Output
Definition: 6Step_Lib.h:174
Generated on Fri Sep 11 2015 16:47:21 for X-CUBE-SPN7 for X-NUCLEO-IHM07M1 by   doxygen 1.8.9.1