Was seeing a lot of coupled noise on stormcore with phase currents so I turned up the LPF on the motor temp sensor. I think it might be a good idea to turn up that LPF generally since motor temp is generally slow to change anyways.
Also found a problem in the #define for motor temp 2 in my header file. Fixed it.
Should provide a slightly more accurate estimate of the remaining battery, I fit a fifth order polynomial to a discharge graph of a samsung 30q cell.
Technically the watt hours left should be integrated across this curve instead of using the average remaining voltage but maybe the combination of both provides a good midway estimate between the actual curve and a line since all cells are slightly different.
Modified hw config of 100D to get running.
Increased delay in drv8323s to improve stability of spi bus (was getting erroneous read/write at anything lower)
added custom settings for drv8323s for things like adjustable gate drive currents and shunt amplifier gains. Maybe should move to hw conf and do the motor switch from mc_interface.
Fixes a low level SPI timing bug.
Provide Loss of Signal, Degradation Of Signal and Loss Of Tracking
fault sources, and stats to the 'encoder' terminal command.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
When enabled, the Break (or BRK) is a mechanism that upon a active
level in the TIMx_BRK pin disables asynchronously the PWM output pins,
achieving fast reaction times when an external fault even happens.
See AN4277.
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
Rename paltatech naming to Axiom.
For safety set Axiom default max input voltage to 0.0V so it can not run a
motor without mc_conf being explicitly configured by the user.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2 failure modes added:
* On boot, when calculating DC offsets generate a fault if the offset is beyond
HW_MAX_CURRENT_OFFSET. Fault code reports which sensor is having issues (1, 2 or 3).
Most likely cause is a disconnected sensor, if hw has fault-detecting pullups.
* On runtime, in setups with 3 in-line phase current sensors, checks that the sum
of the currents is below MCCONF_MAX_CURRENT_UNBALANCE, with a configurable low pass
filter. If unbalanced current is high, it means a fault to ground, or a disconnected
sensor (this works at 0 Amp if hw has pullups in the sensor input to detect the
failure).
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
Use m_foc prefix so in VESC Tool they are edited in
FOC->Encoder.
Generate confgenerator.c and .h using VESC Tool.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
Sin/Cos signals are checked to make sure the module of the vector
is larger than 1V and smaller than 1.65V. A working encoder will
never have both sin and cos signals at 0V (zero amplitude module).
Both sin and cos at 3.3V is also not a possible value.
Errors are logged independently for signals too large and for
signals too small, provinding the user more insight when an encoder
fault happens. In the terminal, the 'encoder' command will show
the error counts and error rates of the encoder being used.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
Reads sine and cosine on ADC_IND_EXT and ADC_IND_EXT2, usually
used for ACCEL and REGEN inputs. Provides offset and gain
compensation and is implemented using floating point math.
Note it includes the full mc_interface.h into encoder.c only
to access the ADC readings, and no filtering is performed on
the signals.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>