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>