...
The “Hardware Abstraction Layer“ (HAL) contains 6 components to communicate with the hardware. The HAL layer uses motor control-related peripherals embedded in the netX90 IC. More detailed information about these peripherals can be obtained from NEW netMOTION and netX 90 in Motion. For even more detailed information, see section 5.14 from https://hilscher.atlassian.net/l/cp/bAdPTfB1 netX 90 - Technical data reference guide.
Timer
It provides the main motion application task timer event of the FOC. It is designed with the flexibility to adapt to future requirements.
...
The MPWM component is used to modulate the 3-phase PWM signal required for motor control. Thanks to the “Event Counter Zero (ECZ)“, it generates events so that measurements, transformations, and PI controls are made and new SVPWM duty cycle values are adjusted. Event Counter Zero (ECZ) is the reduced frequency of “Beginning of Period (BOP)” events variant. If the field evt_cnt_top of register mpwm_cfg is set to a value N, an ECZ event will be sent every N+1 period. Ayrica MPWM can be synchronized to hardware-assisted cyclic network events. For detailed information, see section 5.14.3 from https://hilscher.atlassian.net/l/cp/bAdPTfB1. netX 90 - Technical data reference guide.
QEI (Quadrature Encoder Interface)
The QEI component provides information from the Quadrature Encoder, which is mounted on the motor. Method 4 was used as the speed estimation method (see section 5.14.4.11 from https://hilscher.atlassian.net/l/cp/bAdPTfB1 netX 90 - Technical data reference guide). It supports working with ENC0(QEI 5V TTL) and ENC1(RS422) encoder sources. The NXHX-DH adapter module serves to connect digital transmitters as TTL or RS422 (see section 3.4 from https://hilscher.atlassian.net/l/cp/15PQ1Qu1 NXHX 90-MC manual). Also, this component supports the encoder direction inversion functionality. For detailed information, see section 5.14.4 from https://hilscher.atlassian.net/l/cp/bAdPTfB1 netX 90 - Technical data reference guide.
Hall Sensor
The Hall Sensor component provides information from the Hall Sensors, which are integrated into the motor. The Rotor position can be known by the currently active Hall Sensor. Hall sensor inputs are connected to GPIOs and according to these GPIO statuses, it can be easily determined in which hall sector the rotor is.
...
Parameter name | Data type | Default value | Description | Related module | |
---|---|---|---|---|---|
MCL_INIT_PRM_MAX_PHASE_CURRENT_AMP | float | 40.0f | Maximum phase current. | MCL | |
MCL_INIT_PRM_MAX_ADC_VREF_PIN_VOLTAGE | float | 3.3f | Maximum ADC Vref pin voltage. | ||
MCL_INIT_PRM_MAX_PHASE_SHUNT_RES_OHM | float | 12.0f | Maximum phase shunt resistor value[Ω]. | ||
DEFAULT_MCL_MOTION_PAR_MECH_SPEED_LOW_PASS_FILTER_HZ | uint16_t | 1500 | Mechanical speed low pass filter's cut-off frequency[Hz]. | MCL Motion | |
DEFAULT_MCL_MOTION_PAR_FIELDWEAK_CONTROLLER_KP | float | 0.0f | Proportional gain of the field-weakening controller. | ||
DEFAULT_MCL_MOTION_PAR_FIELDWEAK_CONTROLLER_KI | float | 0.2f | Integral gain of the field-weakening controller. | ||
DEFAULT_MCL_MOTION_PAR_FIELDWEAK_START_VOLTAGE_RATIO | float | 1.1f | Threshold voltage vector magnitude to start field-weakening. Value is less than maximum voltage vector magnitude to allow a transition region. | ||
DEFAULT_MCL_MOTION_PAR_STALL_DETECTION_SPEED_DIFFERENCE | uint16_t | 300 | Speed difference threshold to detect stall. | ||
DEFAULT_MCL_MOTION_PAR_STALL_DETECTION_TIME_MS | uint32_t | 3000 | Time[ms] it takes to set stall error. | ||
DEFAULT_MCL_FOC_CTRL_PAR_CURRENT_AMP_GAIN | float | 20.0f | DRV8323 gate driver current sense amplifiers gate. It gains the measured current value through shunt resistor. It is using for the current measurement purposes. | MCL Foc Control | |
DEFAULT_MCL_FOC_CTRL_PAR_DCBUS_VOLTAGE_OFFSET_DIGITS | int8_t | 10 | Experimentally determinced DC-bus Voltage offset value. | ||
DEFAULT_MCL_FOC_CTRL_PAR_NUMBER_OF_CURRENT_OFFSET_MEAS | uint8_t | 8 | Number of measurements to calculate average current offset. | ||
DEFAULT_MCL_FOC_CTRL_PAR_CURRENT_OFFSET_THRESHOLD_DIG | Number of digits allowed for current offset. uint8_t | 48 | _t | 88 | It is the threshold value that defines the range where the average Current Offset value can be found. Ideal current offset = 2048 (The half of the 12-bit ADC’s max range) |
DEFAULT_MCL_FOC_CTRL_PAR_MAX_DUTY_CYCLE_PERCENT | float | 96.0f | Maximum allowed duty cycle percentage. | ||
DEFAULT_MCL_PSE_PAR_SPEED_EST_METHOD | MCL_SPEED_EST_METHOD_E | MCL_SPEED_EST_QEI | Speed estimation method. MCL_SPEED_EST_QEI - Quadrature Encoder Interface MCL_SPEED_EST_HALL_SENSOR - Hall Sensor | MCL Position and Speed Estimation | |
DEFAULT_MCL_PSE_PAR_MAF_CAPTURE_SIZE | uint8_t | 4 | Moving average filter size. Captured position is filtered with a MAF. It is designed experimentally and disabled by default. | ||
DEFAULT_MCL_CAL_PAR_REQUESTED_VOLTAGE | float | 0.12f | Length of the voltage vector used for calibration in units of the commutation. The direction is always Vd. | MCL Calibration | |
DEFAULT_MCL_CAL_PAR_SAMPLING_SPEED_RPM | int16_t | 12 | Rotor speed at calibration stage. Slow speeds are generally more accurate. | ||
DEFAULT_MCL_CAL_PAR_NUM_OF_TURNS | int16_t | 4 | Number of turns (mechanical angle, electrical angle) of the linear regression in one direction. | ||
DEFAULT_MCL_CAL_PAR_WAIT_TIME_BETWEEN_EACH_SAMPLE_MS | uint16_t | 1 | Adding wait time[ms] when turing left and right before performing linear regression on another sample of (mechanical angle, electrical angle). During the calibration process, the motor rotating occurs using the samples of the mechanical and electrical angles. This parameter specifies the waiting time between two samples. It is one of the parameters that should be checked when proper calibration doesn't occur. | ||
DEFAULT_MCL_CAL_PAR_WAIT_AFTER_ALIGNMENT_MS | uint16_t | 500 | Add wait time[ms] delay after each alignment process. During the calibration process, motor positioning alignment is performed during initial alignment, direction change and validation states. This parameter represents the waiting time after each motor alignment. It is one of the parameters that should be checked when proper calibration doesn't occur. | ||
DEFAULT_MCL_CAL_PAR_MAX_DEVIATION_ANGLE | uint16_t | 4000 | Deviation angle of hall sensor position when turning CW and CCW. Angle is in digits (2^16 is 360 degrees). Maximum electrical angle deviation when validating the calibration values, unit complies with Angle definition above. |
...
Table 11 - Motor-specific configuration parameters
FOC Cycle TIme
FOC cycle time is totally programmable for experienced users. When the users adapt the FOC application to their software, they can tune the CPU load according to their own software by playing with the __FOC_CYCLE_TIME_MS
parameter (Default cycle time is 1ms).
FOC Demo
There are two demo modes:
Cyclical demo mode: Ramp-up, ramp-down, and coast stop demo.
Demo mode with potentiometer: The motor speed is adjusted with the potentiometer on the board.
...
The desired demo mode is activated from the “Targets\wscript” file with manipulation of the __USE_DEMO_POTENTIOMETER
parameter.
Compilation and Flashing
https://hilscher.atlassian.net/l/cp/Lz8DLZjUSee section FOC QEI + Hall demo
Abbreviations
Abbreviation | Description |
---|---|
FOC | Field-Oriented Control |
HAL | Hardware Abstraction Layer |
ADC | Analog-to-Digital Converter |
MPWM | Motion Pulse-Width Modulation |
RPM | Revolutions per minute |
MTPA | Maximum Torque per Ampere |
MTPV | Maximum Torque per Voltage |
PI | Proportional Integral |
PMDC | Permanent Magnet Direct Current |
BLDC | Brushless Direct Current |
QEI | Quadrature Encoder Interface |
MCL | Motor Control Layer |
API | Application Programming Interface |
CW | Clockwise |
CCW | Counter-Clockwise |
ECZ | Event Counter Zero |
BOP | Beginning of Period |
DIR | Direction |
MC | Motor Control |
Hi-Z | High Impedance |
NTC | Negative Temperature Coefficient |
MECH | Mechanical |
ELEC | Electrical |
GPIO | General-Purpose Input/Output |
SVM | Space Vector Modulation |
GDU | Gate Driver Unit |
PSE | Position and Speed Estimation |
MENC | Motion Encoder |