Commit Graph

385 Commits

Author SHA1 Message Date
Benjamin Vedder e29c97f8fc Added ICM-20948 callback to state struct 2019-05-06 22:40:05 +02:00
Benjamin Vedder a80829f5c5
Merge pull request #90 from powerdesigns/virtual-motor-update
Updated virtual motor library
2019-05-04 10:48:47 +02:00
Benjamin Vedder aaf45fc20c Merge branch 'powerdesigns-Axiom-board-support' 2019-05-04 10:44:48 +02:00
Benjamin Vedder 05b1a9483e Merge branch 'Axiom-board-support' of https://github.com/powerdesigns/bldc into powerdesigns-Axiom-board-support 2019-05-04 10:44:03 +02:00
Benjamin Vedder 404bbcf64b Fixed current offset fault bug, added support for multiple IMUs and ICM-20948 2019-05-03 19:55:36 +02:00
Marcos Chaparro 4d93f2fef1 Axiom: configurable current sensor gain
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-27 16:57:35 -03:00
Marcos Chaparro 1d08745376 Axiom control board support
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>
2019-04-27 08:21:46 -03:00
Maximiliano Cordoba 0841a9ce87 updated virtual motor library, adding pole pair numbers into the model, changing variable names to better address the purpose of them, and including flux linkage into the id calculation.
Signed-off-by: Maximiliano Cordoba <mcordoba@powerdesigns.ca>
2019-04-26 11:49:30 -03:00
Benjamin Vedder 490d44dd10 Updated changelog 2019-04-26 12:17:43 +02:00
Benjamin Vedder 8313b32c0c Some fixes on PR 2019-04-26 12:02:57 +02:00
Benjamin Vedder 1e4078a713
Merge pull request #88 from paltatech/current-sensor-fault-detection
Detect current sensor failures
2019-04-26 11:25:30 +02:00
Benjamin Vedder 0551117351 Some HW cleanup and documentation, fixed DRV8301 fault readout bug, added mpu_read_reg terminal command 2019-04-26 11:07:31 +02:00
Marcos Chaparro 6d758b38f2 Detect current sensor failures
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>
2019-04-20 09:43:08 -03:00
Benjamin Vedder 4a9fe93f41 Added support for storing hw-specific and custom variables in EEPROM 2019-04-19 10:42:43 +02:00
Benjamin Vedder a2bf8a87c6 Chuk RPM filter and output rate updates 2019-04-18 23:43:07 +02:00
Benjamin Vedder 023d78679f Fixed flash CRC check 2019-04-18 22:30:01 +02:00
Benjamin Vedder b2816ef596
Merge pull request #87 from paltatech/flash-memory-crc-integrity-check
Flash memory CRC integrity check
2019-04-18 20:02:56 +02:00
Benjamin Vedder 5202ef41d9 Chuk stop PID on dropout, ppm multi vesc duty fix 2019-04-18 20:00:26 +02:00
Marcos Chaparro fbc7767fcb Set crc and flag for memory checks to '1' at build time
Ensures the memory addresses used for flash memory integrity check
are initially 0xFFFFFFFF, so the application can write a new CRC in the
first boot.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-17 21:27:43 -03:00
Marcos Chaparro 4fceb73db9 Continuous flash memory integrity check running on background
Create a new, low priority thread that checks that the CRC of the
flash memory matches the CRC stored in flash.

8kB chunks are computed every 50 milliseconds. A reset is invoked if
CRC does not match.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-17 20:54:08 -03:00
Marcos Chaparro 68ee05ea9c Remove ST CRC library but keep using hardware-accelerated CRC32.
Add integrity check of the vector table.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-16 19:13:01 -03:00
Marcos Chaparro 3c6083c34d Keep the flash memory locked during normal operation
Only unlock when it is necessary to write it. This prevents memory
corruptions caused by software or EMI glitches.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-16 00:33:22 -03:00
Marcos Chaparro 1ae059349f CRC integrity check of flash memory
The check only covers address 0x08008000 to 0x805FFFF, where application
code is stored. It excludes virtual eeprom area (first 0x8000 bytes)
because it is modified on runtime with user configurations.

After a fresh flash programming the CRC is read as 0xFFFFFFFF and firmware
computes and stores the new CRC and a reset is invoked.
After reset the CRC will be available for checking code integrity.

Linker file had a wrong flash2 size, it was set to 480kB, thus allowing
the linking of binaries larger than 393216 (x3 128kB sectors).
The bootloader won't program binaries that span more than 3 sectors.

Now flash2 length is set as (393216 - 8) to ensure that the last 8 bytes
are left blank (0xFFFF) and  reserved for CRC information.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-15 20:56:42 -03:00
Benjamin Vedder e09bc7ce22 Increased version number and updated configuration signatures 2019-04-14 07:44:55 +02:00
Benjamin Vedder 8ec5723f89
Merge pull request #82 from paltatech/virtual-motor
Add command to connect a virtual motor with configurable parameters
2019-04-14 07:24:23 +02:00
Benjamin Vedder 025334c141
Merge pull request #85 from tipsmiller/master
Add new control type to ADC application
2019-04-14 07:22:56 +02:00
Benjamin Vedder 0a025ef301
Merge pull request #81 from paltatech/sin-cos-encoder-support
Sin cos encoder support
2019-04-14 07:21:36 +02:00
Gavin Miller 9deee721f5 Fix indentation, restore proper include to app_custom 2019-04-09 19:12:09 -06:00
tipsmiller 36a3e458a0 Switch HW version back to 60 2019-04-09 16:29:32 -06:00
tipsmiller 583e71464e Update app_adc with new control scheme 2019-04-09 16:11:11 -06:00
Marcos Chaparro d80227b9b4 Rename sin/cos m_conf structure fields
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>
2019-04-08 21:05:46 -03:00
tipsmiller 3639c6c5f8 Remove custom app. Add new entry for adc ctrl type 2019-04-08 17:45:46 -06:00
Marcos Chaparro 8c4fc35ca0 Move sin/cos signal pin definitions to hwconf/
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-08 18:59:07 -03:00
tipsmiller 48a1e395dd Change HW version to 4.12. Working "clone" of app_adc as custom app. 2019-04-07 19:05:26 -06:00
Gavin Miller 32853a9c4c Copy functionality from app_adc 2019-04-07 13:51:25 -06:00
Marcos Chaparro 29934c90b6 Fix codacy warning
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-06 10:46:34 -03:00
Maximiliano Cordoba 4a94d0ec4c Add command to connect a virtual motor with configurable parameters
This commit adds a motor model running within the vesc firmware,and
from the vesc terminal a user or a test script can set the
mechanical load torque, inertia, phase resistance, Lq and Ld phase
inductances (this generic model includes IPM motors), flux linkage
and battery voltage.

Virtual motor parameters set at the command line should match with
vesc configuration, for example phase resistance, inductance and
flux linkage should match and have the correct observer gain.
Observer works with the virtual motor, with some hiccups during
startup
For solid results its better to use sensored mode. If vesc is
configured to use an SPI encoder the virtual motor phase angle
will be injected as an encoder angle readout.

For safety PWM outputs are disabled during simulation.

Signed-off-by: Maximiliano Cordoba <mcordoba@powerdesigns.ca>
2019-04-06 10:36:00 -03:00
Marcos Chaparro de707e0975 Add SinCos encoder checks and fault management
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>
2019-04-02 10:37:15 -03:00
Marcos Chaparro 153deef9af Add configurable low pass filtering to SinCos encoder analog signals
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-04-01 08:35:22 -03:00
Marcos Chaparro b155d5219a Basic SinCos encoder support
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>
2019-04-01 08:35:22 -03:00
Benjamin Vedder fb9442889a
Merge pull request #80 from paltatech/powerdesigns-revB-support
Extend support to older PowerDesigns RevB boards
2019-03-31 11:37:59 +02:00
Benjamin Vedder 75abfc2593 Made build script non-verbose and removed some codacy warnings 2019-03-31 11:21:28 +02:00
Benjamin Vedder 1161f8417c Added SWD programming support (based on Black Magic Probe) and open loop duty cycle control 2019-03-31 10:49:18 +02:00
Marcos Chaparro 3ab585cb9a Force high current measuments when using big powerstages
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-03-28 20:33:21 -03:00
Marcos Chaparro b2311b9eca Extend support to older PowerDesigns RevB boards
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-03-25 18:02:26 -03:00
Benjamin Vedder 39bb8a6b09 FW 3.53: Limit foc_current_filter_const range, 1Mbit/de NRF speed, lower detect f_sw for resistance, no temp_comp by default 2019-03-20 22:46:36 +01:00
Benjamin Vedder 3bf1c13b76 Added missing firmwares 2019-03-10 15:22:27 +01:00
Benjamin Vedder 0bf3cc65ed Fixed codacy warnings 2019-03-10 15:19:05 +01:00
Benjamin Vedder 65298263b6 75/300 R2 support, terminal sync cmd, IMU support, option to disable permanent UART, collected timer functions in one place 2019-03-10 14:57:42 +01:00
Benjamin Vedder 0db2f200f6 Updated some comments in commands to make it easier to follow 2019-03-05 07:33:31 +01:00