stm32-sine

Main firmware of the Huebner inverter project

GPL-3.0 License

Stars
160
stm32-sine - v5.35.R Latest Release

Published by jsphuebner 5 months ago

  • Speed dependent regen pedal travel, use maxregentravelhz
  • Bugfix i3 hardware
  • Support pin swap (only PWM channels) in sine firmware also
  • Improved sampling of analog values (use second ADC)
  • Added limiter cruise mode
  • Fix terminal problems causing lockup or even watchdog reset
  • On Prius inverters ignore break signal when ocurlim==-1
  • More reliable pressed throttle detection
  • Smoother over temperature derating
  • Limit potmax to 3500 to prevent using over range pedal connection
  • Add uptime counter, can be used as CAN alive counter
  • In SINE firmware filter idc for smoother battery current derating
stm32-sine - Safety Release

Published by jsphuebner about 1 year ago

This release strives to improve safety. It will make some things slightly harder, read on

  • Potential bug fix in scheduler
  • Throttle/torque limit for cruise control
  • Cruise control mode "button" removed because it cannot be cancelled if brake pedal switch fails
  • Brake pedal check at startup if cruise control is used
  • Cruise control only works when forward direction is selected, i.e. din_forward is high (use SwitchReversed if for your setup reverse is actually forward)
  • When sending cruise rpm preset via CAN din_cruise must also be activated
  • Explicitly Force 0 throttle when switching to neutral
  • Safety critical control parameters now have a fixed mapping in one message with sequence and optional CRC check and can no longer be freely mapped. Your custom mapping will be deleted when running this software
  • In FOC ramp down field weakening when rpm limit is surpassed by 10%
  • Traction control added
  • Fixed in CAN SDO json printing
  • New way of mapping values to CAN via SDO
  • Legacy terminal commands (list, atr, help, all) removed
  • Dodgy speed frequency output removed (until someone complains)
  • Display rotor direction and selected direction separately
  • Allow switching from neutral into rotor direction
stm32-sine - Many small fixes

Published by jsphuebner over 1 year ago

When upgrading to this version your canspeed will be off by one, as the new speed 125k has been added. You need to manually set it to the desired speed again.
As always there is the possibility of overspeeding the motor especially when it's unloaded. Set fwcurmax=0 for unloaded tests.

  • Removed ManualMode in FOC, now always adding manualid and manualiq to controller calculated values
  • Added manualstart parameter, has the same effect as pulling start pin high
  • Don't apply backwards regen if motor is already turning backwards
  • Make sine output filter "filterConst" a configurable value "sinefilter"
  • Improve ilMax calculation
  • Add an option to scale voltage and slip simultaneously with throttle
  • CAN mapping is now more flexible:
  • gain factor is now in floating point format, no more awkward multiplication by 32 for RX items
  • More than 8 items can be mapped to one message
  • An optional offset can be added between -128 to 127
  • Make maximum modulation index variable to allow over modulation
  • Bugfix: tmpm and tmphs were unfiltered
  • Added separate proportional gain parameter for id-controller
  • Scale creep torque with inverse brake pressure (if brake pedal configured)
  • Corrected ids of id/iq to make it mappable to CAN
stm32-sine - The actual ultimate field weakening release

Published by jsphuebner almost 2 years ago

While the least release was meant to finally fix high speed related errors this one actually does, tested on many cars.
Details:

  • Removed curkifrqgain, it seems no longer needed and creates confusion
  • Added binstream command (binary streaming of real time data)
  • PWM overflow fix in FOC implementation
  • Limit iq at the same rate that ifw is ramped up
  • Limit id MTPA at the half the rate that ifw is ramped up
  • Replaced field weakening controller with simple IIR filter which is smoother
  • Do not disable PWM when stationary with Prius inverter
stm32-sine - The ultimate field weakening release

Published by jsphuebner about 2 years ago

Long time, no release!
This release adds some bells and whistles but most of all it seems to fix all unwanted regen, unwanted acceleration and trip outs when operating at high motor speeds. Highly recommended for all sync motor/FOC users.
Many things have been added:

  • Hill hold functionality
  • Bidirectional throttle support, throttle sets torque and direction (e.g. for boats)
  • Throttle speed mode, throttle sets speed rather than torque (also for boats)
  • Regen parameters received hopefully more intuitive names
  • Pull down PWM pins already in bootloader when active high PWM selected
  • Never run idle speed controller in off mode, caused some issue, don't remember which one
  • Less ADC averaging in FOC mode for better transient response
  • MTPA motor variables are now parameters
  • Field weakening is now based on around limiting PWM amplitude
  • Torque command is limited in field weakening mode
  • Improved PI controller anti-windup
stm32-sine - Unwanted Regen Fix

Published by jsphuebner almost 3 years ago

  • Using filtered frequency to calculate syncadv
  • Fixed bug with regen ramp
  • Also downramping throttle with throtramp
  • no longer limit d-controller output to half amplitude. Can cause unwanted regen
  • Removed unused hardware variants
stm32-sine - Bugfix of 5.11.R - change log repeated

Published by jsphuebner about 3 years ago

  • Fixed integer overflow in temperature sensing
  • Added Epcos temp sensor
  • Fixed filter rounding error in SetTorquePercent
  • Fixed misinterpretation of pot2 configuration (would result in no regen)
  • Limiting q and d controller outputs to sane values to avoid stuttering and over current trips
  • First save CAN map then parameters to be compatible with 2k flash pages
  • Dynamically switch over to BMW i3 SPI comms when so configured
  • Boot loader pin commands changed to new semantics
  • Fix FOC current offset calibration
  • Adding support for outlander front motor temp sensor
  • Using float math for slow functions (should make no functional difference, just easier to maintain)
  • Bugfix temperature derating
  • Clearing precharge output after some delay of closing DC switch
  • Added Jon Volk mods for ACIM
  • Removed M3 detection for now, detected Prius MG1 MCU as Tesla
  • Support precharge during bootloader
  • Remove heatcurrent code
  • Do not disable PWM in neutral gear (would cause over current when enabling again)
  • Added ffwstart parameter which defines where field weakening controller starts to ramp up
stm32-sine - Many FOC improvements (and sine, too!)

Published by jsphuebner about 3 years ago

  • Limiting q and d controller outputs to sane values to avoid stuttering and over current trips
  • First save CAN map then parameters to be compatible with 2k flash pages
  • Dynamically switch over to BMW i3 SPI comms when so configured
  • Boot loader pin commands changed to new semantics
  • Fix FOC current offset calibration
  • Adding support for outlander front motor temp sensor
  • Using float math for slow functions (should make no functional difference, just easier to maintain)
  • Bugfix temperature derating
  • Clearing precharge output after some delay of closing DC switch
  • Added Jon Volk mods for ACIM
  • Removed M3 detection for now, detected Prius MG1 MCU as Tesla
  • Support precharge during bootloader
  • Remove heatcurrent code
  • Do not disable PWM in neutral gear (would cause over current when enabling again)
  • Added ffwstart parameter which defines where field weakening controller starts to ramp up
stm32-sine - Big FOC fix

Published by jsphuebner over 3 years ago

  • Fixed anti-windup issue, this could cause very strong unwanted regen in the upper speed range - SAFETY CRITICAL!
  • Improved idc filtering for smoother DC current limiting
  • add a parameter 'sincosofs' - this is the midpoint reading of a sin/cos encoder output, removing the requirement for a precise 1.65V midpoint and resistor divider if using, for example, a sin/cos chip that doesn't work on 3.3V VCC (MLX91204 requires 5V)
  • Obey DC voltage limit in boost mode
  • Disallowed saving parameters in run mode
  • Added support for BMW i3 gate driver board SPI ADC
  • Changed ADC sample time to 7.5 clocks
  • Taking 8 samples from last PWM period instead of 3
  • Rotor movement compensation becomes active above 10 Hz
  • Auto-detect flash size and write parameters to according address
stm32-sine -

Published by jsphuebner over 3 years ago

  • Allow running booster from user PWM channel at 8k8 Hz
  • Allow setting nodeid for SDO messages and also for terminal
  • Allow only enabling terminal with certain node id (meant for dual motor boards)
  • Corrected FOC idc calculation to allow meaningful DC current limits
stm32-sine - Small Fixes

Published by jsphuebner almost 4 years ago

  • Removed Prius MG1 detection, wasn't reliable
  • Added support for CAN scaling < 1. But now you cannot scale up more than 32!
  • FOC: running offset calibration continuously while idle -> smoother low speed operation
  • Custom charge PWM handling for Prius hardware (alpha, needs testing)
  • Bugfix in temp calc module when reaching lower limit of lookup table use minimum
  • Force precharge off in bootloader, also fixes Tesla misdetection
stm32-sine - Prius charging

Published by jsphuebner almost 4 years ago

  • Added chargepwmin parameter for synchronous converters like Prius
  • Re-introduced offset calibration at standstill
  • Starting PWM before closing contactor (only Prius Gen2
  • Detecting MG1 MCU of dual motor Prius Gen3 board
  • Fixed sine manual mode
  • "json hidden" command prints all parameters including hidden ones
stm32-sine - Many little things

Published by jsphuebner about 4 years ago

  • Preparation for boot loader pin initialization
  • Added Toyota motor temperature sensor
  • Added tripmode "AutoResume" that will restart inverter 0.5 seconds after it tripped - do not use with FOC code!
  • Ramping up heat dissipation current to avoid controller overshoot
  • Improved initial current sensor offset calibration
  • Fixed spurious current offset warnings
  • Allowing 0 potmin/max again, ADC reading cannot drop below 0
  • Removed high rpm regen limit - it was a work around against high rpm trips which can be fixed with 0.3 regenramp
  • Changed injected sequence to sample first resolver channel twice instead of dummy pin - better noise behaviour
  • Do not update velocity info in single channel mode when difference in pulse length is > factor 2
  • Implement chargemax again
  • Fixed cruise control issue when off pedal regen is turned off
  • Fixed division by 0 error
stm32-sine -

Published by jsphuebner about 4 years ago

  • Tesla M3 mod board support
  • Fixed Leaf heat sink sensor unselectable
  • AC current limit code can be disabled by setting current limit to 0
  • Eliminate spurious over current warning
  • Fixed disabled regen when pot2 is not connected
  • Pull up emcystop on Prius hardware
  • Vary sign of field weakening controller gain with direction
  • Add parameter index to json output
  • Disallow negative throtcur
stm32-sine - Convinience release

Published by jsphuebner over 4 years ago

  • Removed parameters that don't need changing (and cause problems when changed)
  • Added "AlwaysForward" direction mode that defaults to forward unless reverse pin is high
  • Allow swapping PWM outputs 2 and 3
  • Allow dirchrpm up to 20000
  • Use latest libopencm3
  • Add special heat sink temperature code for Prius Gen2 power stage
  • Removed PWMSTUCK fault, it was too irritating
stm32-sine - Tesla Temperature fixes, FOC improvements

Published by jsphuebner over 4 years ago

  • Added support for driving "useless" current into the motor in order to heat up cabin in standstill
  • Added various temperature sensors
  • Hopefully fixed Tesla muxed temp sensor issues for good
  • Trying to mitigate false positive on LORESAMP
  • Fixed pin mapping issues, prevented start on Tesla boards
  • Simpler and apparently more effective speed/frequency calculation in resolver mode (same routine as AB encoder)
  • Seperate max regen setting for cruise control
  • Keep PWM enabled when there is id OR iq current request (smoother coast down)
  • CAN fixe for more than 3 received message IDs
  • Fixed possible over current trip on FOC startup
  • Added motor temperature derating
  • Added derating parameters for heatsink and motor
  • Do not read BMS input on Tesla hardware
  • Deleting timer capture buffer on standstill (single channel mode, caused startup trips)
  • Moved charge code to pwmgeneration module and using PI controller
  • The latter did achieve power factor up to 0.93 in boost charging mode
  • Recalibrate current sensor offset on every standstill
  • Added initial support for Prius board
stm32-sine - Rev Limiter Fix, More filtering

Published by jsphuebner over 4 years ago

  • Changes apply to sine and FOC version
  • Moved deraters behind throttle ramp so they take immediate action, not via ramp
  • Added filtering to rev limiting derater, otherwise it oscillated so much that over current trips would happen
  • FOC: Added filters before adaptive integral gain calculation and field weakening controller
stm32-sine - FOC Improvements

Published by jsphuebner over 4 years ago

  • Removed bus voltage based field weakening controller
  • Added frequency dependency of curki
  • Added throtmin parameter to be able to limit regen externally
stm32-sine - Well working FOC

Published by jsphuebner over 4 years ago

Finally I found the culprit of the misbehaving current regulators: they need very high integral gain!
This version removes all the kludges added to circumvent this fact and it sets the default of curki to 20000. If you're upgrading from an earlier version make sure to set curki to 20000.

stm32-sine - Field Weakening, Cruise Control, Manual Mode

Published by jsphuebner over 4 years ago

  • Added FOC manual mode: manually set id and iq. Use with extreme care, not motor speed limit!
  • Throttle ramp is now also applied to cruise control
  • Third id controller increases field weakening current if torque target isn't met