/**
******************************************************************************
* @file drive_parameters.h
* @author Motor Control SDK Team, ST Microelectronics
* @brief This file contains the parameters needed for the Motor Control SDK
* in order to configure a motor drive.
*
******************************************************************************
* @attention
*
*
© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.
*
* 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
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DRIVE_PARAMETERS_H
#define __DRIVE_PARAMETERS_H
/************************
*** Motor Parameters ***
************************/
/******** MAIN AND AUXILIARY SPEED/POSITION SENSOR(S) SETTINGS SECTION ********/
/*** Speed measurement settings ***/
#define MAX_APPLICATION_SPEED_RPM 4000 /*!< rpm, mechanical */
#define MIN_APPLICATION_SPEED_RPM 0 /*!< rpm, mechanical,
absolute value */
#define MEAS_ERRORS_BEFORE_FAULTS 3 /*!< Number of speed
measurement errors before
main sensor goes in fault */
/****** Hall sensors ************/
#define HALL_MEAS_ERRORS_BEFORE_FAULTS 3 /*!< Number of failed
derived class specific speed
measurements before main sensor
goes in fault */
#define HALL_AVERAGING_FIFO_DEPTH 6 /*!< depth of the FIFO used to
average mechanical speed in
0.1Hz resolution */
#define HALL_MTPA false
/* USER CODE BEGIN angle reconstruction M1 */
#define REV_PARK_ANGLE_COMPENSATION_FACTOR 0
/* USER CODE END angle reconstruction M1 */
/************************** DRIVE SETTINGS SECTION **********************/
/* PWM generation and current reading */
#define PWM_FREQUENCY 16000
#define PWM_FREQ_SCALING 1
#define LOW_SIDE_SIGNALS_ENABLING LS_PWM_TIMER
#define SW_DEADTIME_NS 800 /*!< Dead-time to be inserted
by FW, only if low side
signals are enabled */
/* Torque and flux regulation loops */
#define REGULATION_EXECUTION_RATE 1 /*!< FOC execution rate in
number of PWM cycles */
/* Gains values for torque and flux control loops */
#define PID_TORQUE_KP_DEFAULT 1200
#define PID_TORQUE_KI_DEFAULT 600
#define PID_TORQUE_KD_DEFAULT 100
#define PID_FLUX_KP_DEFAULT 1200
#define PID_FLUX_KI_DEFAULT 600
#define PID_FLUX_KD_DEFAULT 100
/* Torque/Flux control loop gains dividers*/
#define TF_KPDIV 8192
#define TF_KIDIV 16384
#define TF_KDDIV 8192
#define TF_KPDIV_LOG LOG2(8192)
#define TF_KIDIV_LOG LOG2(16384)
#define TF_KDDIV_LOG LOG2(8192)
#define TFDIFFERENTIAL_TERM_ENABLING DISABLE
/* Speed control loop */
#define SPEED_LOOP_FREQUENCY_HZ 1000 /*!