Commit Graph

520 Commits

Author SHA1 Message Date
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
Benjamin Vedder 9cbddf4066 Increased AS5047 error rate threshold 2019-03-04 20:05:20 +01:00
Benjamin Vedder aa13c3b345 Fixed build with servo out enabled, added prebuild firmwares 2019-03-04 19:29:05 +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
Benjamin Vedder a8b3f9d3e1 Merge branch 'master' of https://github.com/vedderb/bldc 2019-03-01 17:18:43 +01:00
Benjamin Vedder 2584774d4a
Merge pull request #72 from Flytrex/encoder-check-PR
AS5047 encoder parity check
2019-03-01 17:18:33 +01:00
Benjamin Vedder f9ce429447 Ramping updates 2019-03-01 17:18:07 +01:00
vadim e70be9e17a filter out zero encoder reading - can be caused by gnd short 2019-03-01 11:45:34 +02:00
vadim 8cc3ea519a update the help text for the terminal with the new encoder command 2019-03-01 11:00:32 +02:00
vadim 611ad1e1d1 reset the erro rate in encoder deinint as well 2019-02-28 19:31:27 +02:00
vadim 9488eb9008 moved encoder fault triggering to timer thread, added FOC mode check 2019-02-28 18:58:17 +02:00
vadim c7515fbda5 reset error rate when initializing encoder 2019-02-28 11:08:09 +02:00
vadim f668b89db5 trigger a fault when AS5047 encoder SPI communication is broken 2019-02-25 14:43:02 +02:00
vadim 5b09d687b8 debug function for encoder CRC 2019-02-25 14:37:54 +02:00
vadim 46d9361886 reject encoder readings with bad CRC 2019-02-25 14:34:17 +02:00