Commit Graph

278 Commits

Author SHA1 Message Date
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 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
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
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 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
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 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 35c1c72ab4 Commands restructuring for thread safety, 75/300 vreg fix, fixed relative current commands 2019-03-04 19:23:38 +01:00
Benjamin Vedder 01e72eb555 Autogenerated config parsing with signatures, fixed previous PRs 2019-03-01 21:36:58 +01:00
Marcos Chaparro 723abcb09f Remove ST DAC library and use the DAC by direct register access
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-02-19 11:40:49 -03:00
Marcos Chaparro b344e873b6 Remove duplicated flux linkage detection function
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-02-19 10:55:40 -03:00
Marcos Chaparro 32cf05629d Resolve merge conficts with major 2019 release
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-02-18 20:25:52 -03:00
Benjamin Vedder 123bb00ab4 Major 2019 update 2019-02-18 19:30:19 +01:00
Marcos Chaparro 4ac69232d9 Configure deadtime by just defining it in nanoseconds. Firmware will calculate the required DTG register value.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-01-31 00:51:35 -03:00
Marcos Chaparro 9652231edb Allow to run PWM at frequencies multiples FOC loop to support applications with PWM running at 100+kHz.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-01-30 00:33:56 -03:00
Marcos Chaparro 43dbe80de5 Fix DAC init assertion
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-01-28 02:21:47 -03:00
Marcos Chaparro 69bdc73536 Put a safe limit on ADC ISR frequency to avoid kernel panics. Currently ADC ISR duration is around 26usec, it can not be executed at more than 38kHz
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
2019-01-26 02:36:12 -03:00
Marcos Chaparro 834056a9e5 Use ice40UP5K FPGA bitstream length
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2019-01-18 19:02:18 -03:00
Marcos Chaparro 95d8f70f87 Define on build-time some basic limits for this hardware
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2019-01-10 18:22:47 -03:00
Marcos Chaparro 34bacefe99 Configure Brown Out Reset to keep mcu under reset until VDD reaches 2.7V. Configure Programmable Voltage Detector to interrupt and log a fault when mcu VDD drops below 2.9V.
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2019-01-08 11:36:42 -03:00
Marcos Chaparro 8152d61760 New flux linkage measurement based on open loop FOC to spin up the motor. Removes all calls to BLDC mode to reach the requested erpm
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2019-01-05 19:24:42 -03:00
Marcos Chaparro 89e6022698 Gate driver supply voltage monitoring
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 20:03:12 -03:00
Marcos Chaparro e284d1ae5e Compensate for line-to-line measurement in FOC
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 18:41:10 -03:00
Marcos Chaparro 400d9be3ed Add FPGA configuration on boot
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 17:56:21 -03:00
Marcos Chaparro 0827837e5f Fix disabling wrong ADC channels when DAC is enabled. Added ADC channel descriptions
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 12:43:49 -03:00
Marcos Chaparro 525cbfd160 Generate 12MHz clock for FPGA
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 12:37:50 -03:00
Marcos Chaparro 54ba37b098 Update transfer functions for voltage and current measurements
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 12:10:41 -03:00
Marcos Chaparro bfe1f0dedb Add DAC support
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 12:04:43 -03:00
Marcos Chaparro 4027a4ef8e Fault LED pin change
Signed-off-by: Marcos Chaparro <mchaparro@paltatech.com>
2018-12-12 11:41:24 -03:00
Benjamin Vedder a20c35b338 FW 3.39: AUX pin support, some refactoring 2018-07-06 21:20:54 +02:00
Benjamin Vedder 92a54246f0 DRV and terminal refactoring, DRV8320 updates 2018-04-14 16:28:51 +02:00
Unknown f740900a72 fixed some minor merge errors 2018-04-06 23:46:35 +02:00
Unknown 5d9cc774ab added das_mini and DRV8320 support 2018-04-05 14:20:17 +02:00
Benjamin Vedder 8503444672 Added MINI4 hw, added 75_300 built fw 2018-04-04 23:08:55 +02:00
Benjamin Vedder fcfbf692bb Added missing hw files 2018-03-26 11:37:21 +02:00
Benjamin Vedder 22dc2ce33c FW 3.37: FOC KI temp comp, configurable foc current filter 2018-03-24 22:32:58 +01:00
Unknown 21fec35be9 updated HW conf for newer version 2018-03-15 12:59:39 +01:00
Benjamin Vedder bf27cb673e Removed software servo driver, fixed hw servo driver to work with all hardwares 2018-02-28 10:22:25 +01:00
Benjamin Vedder 6277cf74ca FW 3.31: Acc temp dec option, PID for APP_ADC 2017-10-27 21:29:12 +02:00
Benjamin Vedder e83af32219 Some cleanup, updated speed PID controller, some NAN-checks, iterative observer 2017-10-20 20:06:06 +02:00
Benjamin Vedder 79bfbe6234 FW3.28: dual throttle curves, ntc beta factor config, board file added 2017-09-06 21:13:28 +02:00
Benjamin Vedder f141157358 First official commit after the VESC Project release 2017-09-04 21:12:43 +02:00
Benjamin Vedder 5dbc94c525 FW 3.7 2016-11-04 15:18:34 +01:00
Benjamin Vedder d2f6d87560 FW 3.0: HW60 support, 3 low/high side shunt support, permanent NRF option 2016-06-27 17:29:09 +02:00
Benjamin Vedder cb2a205cb8 FW 2.17: as5047 support, change sensor port mode in conf, better encoder detection, FOC ah and wh counter fixes 2016-04-27 15:32:32 +02:00
Benjamin Vedder 2377a45bcb FW 2.5: red LED fix on hw 4.5, updated default PID parameters 2015-12-19 21:24:46 +01:00
Lucas Pleß bcb38e0de3 fixed the ADC layout for board 4.10 2015-10-17 01:11:39 +02:00
Benjamin Vedder c4ff81e849 Ported to ChibiOS 3, refactoring, cleanup, added safe start delay after fault for PPM app, removed unused ST libraries 2015-10-08 23:09:39 +02:00
Benjamin Vedder f2a9875c74 fixed SPI defines 2015-10-04 21:33:55 +02:00
Benjamin Vedder fbb78e9f5d fixed SPI NSS define 2015-10-04 21:23:16 +02:00
Benjamin Vedder 116ef561d0 HW 4.10 support 2015-10-04 20:52:36 +02:00
Benjamin Vedder 984b846401 FW 1.14: configuration loss fix, HW49 support, mcpwm interfaces for apps 2015-10-04 01:43:26 +02:00
Benjamin Vedder 06129bb66c FW 1.13: Hw 4.8 support, new CC implementation for nunchuk, refactoring, custom app and hw config support 2015-09-17 23:24:55 +02:00
Benjamin Vedder 58d892935d PPM dec fix, current sampling updates, ADC cruise control, commutation fix, higher switching frequency, refactoring 2015-08-23 18:26:05 +02:00
Benjamin Vedder bc7a779632 Bootloader support, CAN fixes 2015-05-08 22:53:59 +02:00
Benjamin Vedder 2ccb52514e Encoder support, NRF nunchuk support 2015-04-11 10:07:36 +02:00
Benjamin Vedder 828cdd92f8 Chuk and PPM config structs, phase advance fixes and implementation for delay comm mode, CAN fixes and status message implementation, multi-esc mode for PPM and Chuk, traction control for PPM and chuk, CAN id config, multi-esc and traction control config, ADC sampling change, hall-sensor read bug fix for HW45+ 2015-02-19 21:20:07 +01:00
Benjamin Vedder 3b2703b192 Component values overridable and voltage divider change compensation 2015-01-22 11:48:38 +01:00
Benjamin Vedder 44c1701cf9 Included stable version of ChibiOS, fixed i2c issues, gave more RAM in linker script, added table-based gamma correction for PCB LEDs 2015-01-05 05:48:29 +01:00
Benjamin Vedder d9c5ed7ac3 Added hw 46 and implemented an I2C reset function 2014-11-23 20:29:36 +01:00
Victor Stensson a367058998 Added victors HW 2014-10-25 21:13:16 +02:00
Benjamin Vedder 7c7a315a81 Commutation fixes, timer update change, current measurement fix, fault logging in RAM, current limit fix 2014-10-24 23:04:10 +02:00
Benjamin Vedder f7cda79d1b HW45-implementation, temp-protection, nunchuk-fix, i2c-fixes 2014-10-19 19:31:06 +02:00
Benjamin Vedder 81a6d84113 Nunchuk implementation (Nyko Kama tested), mah and wh counting 2014-10-19 01:00:53 +02:00
Benjamin Vedder d6beda7b47 Complete servo-decoding rewrite, common command module, full access to everything over uart, more ppm options 2014-09-20 03:22:38 +02:00
Benjamin Vedder 58889d6543 Hall sensor fixes and sample send delay removal after fixing a bldc_tool problem 2014-09-15 20:48:46 +02:00
Benjamin Vedder 2c7017c3a3 Voltage terminal command and ebike motor configuration 2014-08-14 00:23:32 +02:00
Benjamin Vedder de123c31a8 Added missing files 2014-06-30 09:50:05 +02:00
Benjamin Vedder 1b4feb77ca Some hall sensor fixes 2014-06-29 14:23:39 +02:00
R.E. Wolff 6a19c24154 added bitwizard harware config file. 2014-06-28 17:21:51 +02:00
Benjamin Vedder a54a79a4d4 Removed some hard-coded parameters 2014-06-26 19:41:57 +02:00
Benjamin Vedder f4b638ed04 Added an application directory and converted some parts of the main function to applications 2014-04-19 00:09:46 +02:00
Benjamin Vedder 1b0a72a07b Some refactoring 2014-04-14 23:02:45 +02:00