This encoder needs x2 16bit SPI transfers so the hardware SPI peripheral
was used to run SCLK at 10MHz and reduce the ISR duration.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
* New "dist" terminal command shows odometer and trip distances.
* Odometer value is sent to UI via COMM_GET_VALUES_SETUP.
* UI can set the odometer via COMM_SET_ODOMETER.
* Unfortunately, the bootloader clears the odometer to 0 when FW is reprogrammed.
* Currently the FW code has CRC checks, but configs are also important!
* This helps maintain FLASH integrity when the config pages are occasionally
re-written due to odometer updates (later commit).
* If the config CRC checks fail, store the fault and fall back to default config.
* New 'crc' terminal command displays CRC values.
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>