X-CUBE-SPN11 for X-NUCLEO-IHM11M1: MC_SixStep_param.h Source File

X-CUBE-SPN11 for X-NUCLEO-IHM11M1

MC_SixStep_param.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file MC_SixStep_param.h
4  * @author
5  * @version V0
6  * @date 10/07/2016
7  * @brief This header file provides all parameters to driver a motor with 6Step
8  library
9  ******************************************************************************
10  * @attention
11  *
12  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
13  *
14  * Redistribution and use in source and binary forms, with or without modification,
15  * are permitted provided that the following conditions are met:
16  * 1. Redistributions of source code must retain the above copyright notice,
17  * this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright notice,
19  * this list of conditions and the following disclaimer in the documentation
20  * and/or other materials provided with the distribution.
21  * 3. Neither the name of STMicroelectronics nor the names of its contributors
22  * may be used to endorse or promote products derived from this software
23  * without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  ******************************************************************************
37  */
38 
39 /** @addtogroup MIDDLEWARES MIDDLEWARES
40  * @brief Middlewares Layer
41  * @{
42 */
43 
44 /** @addtogroup MC_6-STEP_LIB MC_6-STEP_LIB
45  * @brief Motor Control driver
46  * @{
47 */
48 
49 /** @defgroup Main_Motor_parameters Main_Motor_parameters
50  * @{
51  * @brief All motor parameters for 6Step driving
52 */
53 
54 /* ****************************************************************************
55  ==============================================================================
56  ###### BASIC PARAMETERS ######
57  ==============================================================================
58 **************************************************************************** */
59 #define NUM_POLE_PAIRS 2 /*!< Number of Motor Pole pairs */
60 #define DIRECTION 0 /*!< Set motor direction CW = 0 and CCW = 1*/
61 #define TARGET_SPEED 4000 /*!< Target speed in closed loop control */
62 #define POTENTIOMETER 1 /*!< Enable (1)/Disable (0) the potentiometer */
63 
64 
65 /* ****************************************************************************
66  ==============================================================================
67  ###### ADVANCED PARAMETERS ######
68  ==============================================================================
69 **************************************************************************** */
70 /*!< ********************* Open loop control *********************************/
71 #define STARTUP_DUTY_CYCLE 600 /*!< StartUP Duty Cycle*/
72 #define STARTUP_CURRENT_REFERENCE STARTUP_DUTY_CYCLE
73 #define ACC 1000000 /*!< Mechanical acceleration rate (setting available in manual mode, LOAD_TYPE = 0) */
74 #define MINIMUM_ACC 1000 /*!< Mechanical acceleration rate for BIG load application */
75 #define NUMBER_OF_STEPS 20000 /*!< Number of elements for motor start-UP (max value 65535)*/
76 #define TIME_FOR_ALIGN 500 /*!< Time for alignment (msec)*/
77 #define BUTTON_DELAY 1000 /*!< Delay time to enable push button for new command (1 = 1msec)*/
78 #define NUMBER_ZCR 12 /*!< Number of zero crossing event during the startup for closed loop control begin */
79 /*!< ********************* Closed Loop control *********************************/
80 #define SPEED_LOOP_TIME 1 /*!< Speed Loop time (1 = 1msec) */
81 #define KP_GAIN 500 /*!< Kp parameter for PI regulator */
82 #define KI_GAIN 50 /*!< Ki parameter for PI regulator */
83 #define KP_DIV 4096 /*!< Kp parameter divider for PI regulator */
84 #define KI_DIV 4096 /*!< Ki parameter divider for PI regulator */
85 #define LOWER_OUT_LIMIT 50 /*!< Low Out value of PI regulator */
86 #define UPPER_OUT_LIMIT 800 /*!< High Out value of PI regulator */
87 #define MAX_POT_SPEED 20000 /*!< Maximum Speed regulated by potentiometer */
88 #define MIN_POT_SPEED 1700 /*!< Minimum Speed regulated by potentiometer */
89 #define VAL_POT_SPEED_DIV 2 /*!< Validation potentiometer speed divider */
90 #define INITIAL_DEMAGN_DELAY 10 /*!< Initial value for delay time during startup for Bemf detection */
91 
92 /*!< Zero Crossissing parameters */
93 #define BEMF_THRSLD_DOWN 200 /*!< Zero Crossing threshold */
94 #define BEMF_THRSLD_UP 200 /*!< Zero Crossing threshold */
95 
96 /*!< Speed filtering parameters */
97 #define FILTER_DEEP 20 /*!< Number of bits for digital filter */
98 #define HFBUFFERSIZE 10
99 #define ADC_SPEED_TH 82 /*!<Fixed treshold to change the target speed (t.b.f) */
100 
101 /*!< Motor stall detection parameters */
102 #define BEMF_CONSEC_DOWN_MAX 10 /*!< Maximum value of BEMF Consecutive Threshold Falling Crossings Counter in closed loop */
103 #define BEMF_CNT_EVENT_MAX 100 /*!< Maximum number of BEMF Counter in open loop*/
104 
105 /*!< Debug pin */
106 #define GPIO_ZERO_CROSS 1 /*!< Enable (1) the GPIO toggling for zero crossing detection */
107 #define GPIO_COMM 1 /*!< Enable (1) the GPIO toggling for commutation */
108 
109 
110 /*!< Demo mode parameters */
111 #define DEMO_START_TIME 5000 /*!< Time (msec) to keep the motor in run mode */
112 #define DEMO_STOP_TIME 2000 /*!< Time (msec) to keep the motor in stop mode */
113 
114 /*!< Look UP table for dynamic demagn control of speed */
115 #define DEMAGN_VAL_1 1 /*!< Look UP table for dynamic demagn control for speed into (10000,12000] or [-12000,-10000) range */
116 #define DEMAGN_VAL_2 2 /*!< Look UP table for dynamic demagn control for speed into ( 7800,10000] or [-10000,- 7800) range */
117 #define DEMAGN_VAL_3 3 /*!< Look UP table for dynamic demagn control for speed into ( 6400, 7800] or [- 7800,- 6400) range */
118 #define DEMAGN_VAL_4 4 /*!< Look UP table for dynamic demagn control for speed into ( 5400, 6400] or [- 6400,- 5400) range */
119 #define DEMAGN_VAL_5 5 /*!< Look UP table for dynamic demagn control for speed into ( 4650, 5400] or [- 5400,- 4650) range */
120 #define DEMAGN_VAL_6 6 /*!< Look UP table for dynamic demagn control for speed into ( 4100, 4650] or [- 4650,- 4100) range */
121 #define DEMAGN_VAL_7 7 /*!< Look UP table for dynamic demagn control for speed into ( 3650, 4100] or [- 4100,- 3650) range */
122 #define DEMAGN_VAL_8 8 /*!< Look UP table for dynamic demagn control for speed into ( 3300, 3650] or [- 3650,- 3300) range */
123 #define DEMAGN_VAL_9 9 /*!< Look UP table for dynamic demagn control for speed into ( 2600, 3300] or [- 3300,- 2600) range */
124 #define DEMAGN_VAL_10 10 /*!< Look UP table for dynamic demagn control for speed into ( 1800, 2600] or [- 2600,- 1800) range */
125 #define DEMAGN_VAL_11 11 /*!< Look UP table for dynamic demagn control for speed into ( 1500, 1800] or [- 1800,- 1500) range */
126 #define DEMAGN_VAL_12 12 /*!< Look UP table for dynamic demagn control for speed into ( 1300, 1500] or [- 1500,- 1300) range */
127 #define DEMAGN_VAL_13 13 /*!< Look UP table for dynamic demagn control for speed into ( 1000, 1300] or [- 1300,- 1000) range */
128 #define DEMAGN_VAL_14 14 /*!< Look UP table for dynamic demagn control for speed into [ 500, 1000] or [- 1000,- 500] range */
129 
130 #define TRUE 1 /*!< Define TRUE */
131 #define FALSE 0 /*!< Define FALSE */
132 
133 /**
134  * @} Main_Motor_parameters
135  */
136 
137 
138 /**
139  * @} end MC_6-STEP_LIB
140  */
141 
142 /**
143  * @} end MIDDLEWARES
144  */
Generated by   doxygen 1.8.11