Motor Inverter » Parameters

The inverter can be adapted to many kinds of motors, battery packs and driver preferences by changing parameters.

Motor Parameters

The parameters to adjust the inverter to the motor are boost, fweak, fslipmin, fslipmax, polepairs, fmin, fmax and numimp.

They can be deduced from the motors nameplate or by trying which feels best. For illustration we will assume a bus voltage of 500V and a 4-pole (p=2) motor with a nominal speed of n=1450rpm@f=50Hz and 230V. With 500V DC an AC voltage of 500/1.41=355V can be generated.

boost is the digital amplitude of the sine wave at motor startup. It is needed to overcome the motors ohmic resistance. Digital amplitude is an internal quantity. 0 means no voltage is generated at all, 37813 means the full possible voltage is generated.

Example: boost=1700

At full throttle an effective voltage of 1700/37813*355=16V is generated. The best way to find a feasible value is to optimize it in the finished car. Start with the default value and increase until you get a good startup.

fweak is the frequency at which the full possible voltage is generated. It is also the point of the highest motor power. Beyond fweak torque will decrease to the square of frequency and thus power will decrease linear with frequency.

A starting point for fweak is the motors nameplate:


With our illustration motor fweak=355/230*50=77Hz. fweak can be configured lower than that resulting in more torque at the low end.

fslipmin/fslipmax is the slip frequency at which the motor is run at minimum/maximum throttle. fslipmin is set to the motors optimal slip frequency which can be deduced from the nameplate. fslipmin=f-p*n/60. With our illustration motor fslipmin=50-2*1450/60=1.66Hz. fslipmax can be set as high as breakdown torque which is not found on the nameplate. So its best found experimental starting with 2*fslipmin. If set too high the motor will start to rock violently on startup, possibly tripping the over current limit.

polepairs is set to p, 2 in our example.

fmin should be set just below fslipmin.

fmax is used to limit the speed of the motor. The default 200Hz would result in a maximum speed of about 6000rpm.

ampmin Is the minimum relative amplitude fed to the motor. At very low amplitudes the motor does not generate any noticable torque and throttle travel is wasted that does nothing. Find out a good value by experimenting.


Inverter Parameters

pwmfrq Sets the frequency at which the IGBTs are switched on and off. The faster the switching the higher the losses in the inverter and the lower the losses in the motor. The maximum frequency is also limited by the driver boards as explained here.

pwmpol Sets the polarity of the PWM signals, active high or active low. Do not touch this parameter if you don't know what you're doing. When configured inversely it will blow up your power stage immediatly if connected to a potent power source like batteries.

deadtime The time between switching off one IGBT and switching on the other. 28=800ns, 63=1.5µs. More values can be found in the STM32 data sheet. Make sure to test the deadtime at low power levels. Setting the deadtime too low while operating of a potent power source can blow up your power stage!



Parameter Reference

The following parameters currently exist to customize the controller software. Type


to change it. Type


to get the current value.

Parameters are internally stored with 5 binary fraction digits. That means there are 32 possible values after the decimal point. So when you set a value of 0.35 you might end up with 0.33.


Name Unit Minimum Maximum Default Description
boost dig 0.00 37813.00 1700.00 0 Hz Boost in digit. 1000 digit ~ 2.5%
fweak Hz 0.00 400.00 67.00 Frequency where V/Hz reaches its peak
fpconst Hz 0.00 400.00 400.00 Frequency where slip frequency is derated to form a constant power region. Only has an effect when < fweak
fslipmin Hz 0.00 100.00 1.00 Slip frequency at minimum throttle
fslipmax Hz 0.00 100.00 3.00 Slip frequency at maximum throttle
polepairs   1.00 16.00 2.00 Pole pairs of motor (4-pole motor: 2 pole pairs)
ampmin % 0.00 100.00 50.00 Relative sine amplitude at minimum throttle
encflt   0.00 16.00 4.00 Filter constant between pulse encoder and speed calculation. Makes up for slightly uneven pulse distribution
fmin Hz 0.00 400.00 1.00 Below this frequency no voltage is generated
fmax Hz 0.00 400.00 200.00 At this frequency slip is commanded 0 to avoid further acceleration
pwmfrq   0.00 3.00 2.00 PWM frequency. 0=17.6kHz, 1=8.8kHz, 2=4.4kHz, 3=2.2kHz
pwmpol   0.00 1.00 0.00 PWM polarity. 0=active high, 1=active low. DO NOT PLAY WITH THIS!
deadtime dig 0.00 255.00 28.00 Deadtime between highside and lowside pulse. 28=800ns, 56=1.5µs. Not always linear, consult STM32 manual
numimp Imp/rev 8.00 8192.00 60.00 Pulse encoder pulses per turn
potmin dig 0.00 4095.00 0.00 Value of "pot" when pot isn't pressed at all
potmax dig 0.00 4095.00 4095.00 Value of "pot" when pot is pushed all the way in
pot2min dig 0.00 4095.00 4095.00 Value of "pot2" when regen pot is in 0 position
pot2max dig 0.00 4095.00 4095.00 Value of "pot2" when regen pot is in full on position
idlespeed rpm -100.00 1000.00 -100.00 Motor idle speed. Set to -100 to disable idle function. When idle speed controller is enabled, brake pedal must be pressed on start.
idlethrotlim % 0 100 50 Throttle limit of idle speed controller
idlemode   0 1 0 Motor idle speed mode. 0=always run idle speed controller, 1=only run it when brake pedal is released
speedkp Hz 0.00 100.00 1.00 Speed controller gain (Cruise and idle speed). Decrease if speed oscillates. Increase for faster load regulation
cruisemode   0.00 1.00 0.00 0=button (set when button pressed, reset with brake pedal), 1=switch (set when switched on, reset when switched off or brake pedal)
speedflt dig 0.00 16.00 1.00 Filter before cruise controller
bmslimhigh % 0.00 100.00 50.00 Positive throttle limit on BMS under voltage
bmslimlow % -100.00 0.00 -1.00 Regen limit on BMS over voltage
brknompedal % -100.00 0.00 -50.00 Foot on break pedal regen torque
brkpedalramp %/10ms 1 100 100 Ramp speed when pressing the brake pedal. E.g. when you set brkmax to 20% and brkpedal to -60% and brkpedalramp to 1, it will take 400ms to arrive at brake force of -60%
brknom % 0.00 100.00 30.00 Regen padel travel
brkmax % 0.00 100.00 30.00 Foot-off regen torque
brkout % -100 -1 -50 Activate brake light output (GPIOA7) at this amount of braking force
brkrampstr Hz 0.00 400.00 10.00 Below this frequency the regen torque is reduced linearly with the frequency
udcsw V 0.00 1000.00 330.00 Voltage at which the DC contactor is allowed to close
udcmin V 0.00 1000.00 450.00 Low voltage at which a voltage warning light comes on
udcmax V 0.00 1000.00 520.00 High voltage at which a voltage warning light comes on
udclim V 0.00 1000.00 540.00 High voltage at which the PWM is shut down
ocurlim A -500.00 500.00 100.00 Hardware over current limit. RMS-current times sqrt(2) + some slack
minpulse dig 0.00 4095.00 1000.00 Narrowest or widest pulse, all other mapped to full off or full on, respectively
il1gain dig/A 0.00 4095.00 3.09 Digits per A of current sensor L1
il2gain dig/A 0.00 4095.00 3.09 Digits per A of current sensor L2
udcgain dig/V 0.00 4095.00 6.15 Digits per V of DC link
pwmfunc   0.00 2.00 0.00 Quantity that controls the PWM output. 0=tmpm, 1=tmphs, 2=speed
pwmgain dig/C 0.00 65535.00 100.00 Gain of PWM output
pwmofs dig -65535.00 65535.00 0.00 Offset of PWM output, 4096=full on
snshs   0.00 1.00 0.00 Heatsink temperature sensor. 0=JCurve, 1=Semikron
snsm   2.00 3.00 2.00 Motor temperature sensor. 2=KTY83, 3=KTY84
fslipspnt Hz -100.00 100.00 0.00 Slip setpoint in mode 2. Written by software in mode 1
ampnom % 0.00 100.00 0.00 Nominal amplitude in mode 2. Written by software in mode 1


The following values are available for diagnostic purposes. Type


to get the current value. To read more then one you can provide a list like

get il1,il2,udc


Name Unit Description
version   Firmware version
opmode   Operating mode. 0=Off, 1=Run, 2=Manual_run
udc V DC link voltage
idc A Calculated DC current
il1 A AC current L1
il2 A AC current L2
il1rms A RMS current L1
il2rms A RMS current L2
fstat Hz Stator frequency
speed rpm Motor speed
amp dig Sine amplitude, 37813=max
pot dig Pot value, 4095=max
pot2 dig Regen Pot value, 4095=max
potnom % Scaled pot value, 0 accel
dir   Rotation direction. -1=REV, 0=Neutral, 1=FWD
tmphs °C Heatsink temperature
tmpm °C Motor temperature
din_cruise   Cruise Control. This pin activates the cruise control with the current speed. Pressing again updates the speed set point.
din_start   State of digital input "start". This pin starts inverter operation
din_brake   State of digital input "brake". This pin sets maximum regen torque (brknompedal). Cruise control is disabled.
din_mprot   State of digital input "motor protection switch". Shuts down the inverter when =0
din_forward   Direction forward
din_reverse   Direction backward
din_emcystop   State of digital input "emergency stop". Shuts down the inverter when =0
din_ocur   Over current detected
din_bms   BMS over voltage/under voltage
tm_meas us Time taken to calculate new duty cycle in PWM service routine