Commit Graph

185 Commits

Author SHA1 Message Date
Teslafly fce9b85ab9
Add defines for bottom/top gate driver input polarity. (#425)
* Add defines for gate driver pwm output polarity.

* Update gpdrive.c

* Update gpdrive.c

* Update mcpwm.c

* Update mcpwm_foc.c

Co-authored-by: Benjamin Vedder <benjamin@vedder.se>
2022-03-02 10:12:00 +01:00
secupol cb3c0b17dd
Update mcpwm_foc.c 2022-02-21 17:25:46 +09:00
Benjamin Vedder 2b7a698c02
Merge pull request #418 from secupol/master
Update mcpwm_foc.c
2022-02-20 17:57:35 +01:00
secupol ebe8d70190
Update mcpwm_foc.c
It is different from other phase latency.
2022-02-20 16:07:36 +09:00
Benjamin Vedder 468c4f6353
Merge branch 'encoder_split' into master 2022-02-19 15:21:13 +01:00
Benjamin Vedder b881a08e75 Added raw and imu lisp commands 2022-02-06 23:12:05 +01:00
Jakub Tomczak 6a9bd07c72 Merge remote-tracking branch 'origin/master' 2022-01-27 10:28:16 +01:00
Benjamin Vedder 015a657cc9 Sensor port init in only one place, better encoder debug info 2022-01-25 13:57:25 +01:00
Jakub Tomczak da4b3e0edd Merge branch 'master' into dev_fw_5_03 2022-01-21 15:07:44 +01:00
Benjamin Vedder 1b802ebe8f Release motor fix when cc_min_current is 0 2022-01-19 18:52:45 +01:00
Benjamin Vedder 9c484d01e4 Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
Benjamin Vedder 7d38621e32 Indentation fix 2022-01-12 12:32:38 +01:00
Benjamin Vedder 16385f1706 Renamed compression to lzo, added observer offset parameter 2022-01-12 12:27:45 +01:00
Jakub Tomczak 2a120615be encoders to encoder refactor 2022-01-09 17:10:40 +01:00
Benjamin Vedder af55c79a2a Renamed foc_f_sw to foc_f_zv 2022-01-06 20:44:00 +01:00
Benjamin Vedder 95c67175ab First attempt at a resistance and temperature observer 2021-12-29 18:21:42 +01:00
ElwinBoots e4f4bb1d3f [MCPWM_FOC] Make rotor lock feature use D axis
Changes rotor lock feature from Q axis to D axis. This has two advantages:
1. Now the angle you put in is the angle you really get in the alpha beta frame (no 90 degree offset).
2. Now when the rotor is being locked, the D axis is really the D axis and Q is really the Q axis. This helps for FRF measurements.
2021-12-28 19:43:51 -05:00
secupol 480ffbbeb0
Fix fault parameter in mcpwm_foc_measure_inductance function. 2021-12-21 16:35:25 +09:00
Jakub Tomczak 4743194894 old encoder files deleted 2021-12-20 14:18:51 +01:00
Benjamin Vedder 4eec52d5c0 Fix NaN-problem after lost tracking on some motors 2021-12-19 23:55:03 +01:00
Jakub Tomczak f26f3beb2d WIP: 3 encoders partially implemented, AS504x tested
compiled on gcc-arm-none-eabi-7-2018-q2
2021-12-14 16:40:40 +01:00
Benjamin Vedder 2a281e36ae Initialize integrator in dutycycle downramp controller 2021-11-27 23:32:08 +01:00
Benjamin Vedder c5c309e227 More braking improvements 2021-11-27 18:51:02 +01:00
Benjamin Vedder afe85a2937 Handle different max and min currents in braking mode 2021-11-27 16:38:32 +01:00
Benjamin Vedder b524773c0d Another attempt at braking 2021-11-27 10:58:52 +01:00
Benjamin Vedder 76b4f58e4e Another attempt at braking smoothly to 0 2021-11-26 00:43:41 +01:00
Andrej Vlašić 132c603699 Use the same minimal temp value for Temperature compensation 2021-11-24 12:18:29 +01:00
Benjamin Vedder f6e78a09b6 Fixed measured MTPA mode, send ld_lq_diff detection result 2021-11-21 18:17:40 +01:00
Benjamin Vedder fff18eb76b Reset PID controller filters when not running to avoid start glitch 2021-11-15 21:29:05 +01:00
ElwinBoots 78065cf74d SVM sign fix
The original SVM code output was 1-dutycycle instead of dutycycle.
To make the math correct this was "corrected" by having the mod_alpha and mod_beta inputs negative.
This code now instead really fixes the output to dutycycle. Now the input should not be taken negative anymore.
2021-11-13 21:51:20 +01:00
Benjamin Vedder cb84c94788 Disable HFI start in braking mode 2021-11-08 22:48:15 +01:00
Kenn Sebesta 67738328cb [SVM] Comment the function API 2021-11-07 18:21:23 -05:00
Benjamin Vedder bc63a3127a Added q-axis modulation filter and use it for input current limits 2021-11-07 23:00:48 +01:00
Kenn Sebesta 80adea0336 [MCPWM_FOC] Condense math in order to save on FPU operations 2021-11-07 09:01:54 -05:00
Kenn Sebesta 6dbea7ed86 [MCPWM_FOC] Eliminate repeated divisions
`/((2.0/3.0) * v_bus)` is the same as `* 1.5/V_bus`. Abstracting this out
saves at least one division per loop, and in some cases as many as three.

Each STM32F4 FPU division takes 14 cycles.
2021-11-07 07:35:08 -05:00
ElwinBoots bbb8a3d6a8 Added comments to the current loop 2021-11-05 07:32:08 +01:00
Benjamin Vedder d79d12a489 Fixed braking mode 2021-10-31 21:51:40 +01:00
Benjamin Vedder 78e750a338 Scale down measured inductance. Read the comment for details. 2021-10-31 17:47:09 +01:00
Benjamin Vedder 5304872a92 Added missing bracket from PR 2021-10-31 09:35:52 +01:00
Kenn Sebesta d97793bf7b
Update mcpwm_foc.c
Co-authored-by: kalvdans <github@kalvdans.no-ip.org>
2021-10-27 14:14:27 -04:00
Kenn Sebesta 0e58e29072 [MCPWM_FOC] Fix mislabeled variable
It's not estimated RPM, it's estimated rad/sec.
2021-10-27 14:09:10 -04:00
Kenn Sebesta 8de85899b7 [Convenience math] Capture a last couple laggards which were missed earlier 2021-10-27 14:08:35 -04:00
Benjamin Vedder 78887f35cf Added link to forum post as comment to explain factor 4 2021-10-25 12:39:54 +02:00
Benjamin Vedder f1c4e713d7 Added MTPA modes 2021-10-24 18:10:00 +02:00
Benjamin Vedder 98587c961b Updated inductance calculation, include motor saliency in observer, separate setting for MTPA 2021-10-24 13:25:12 +02:00
Benjamin Vedder 8cf082e0e0 Better bus current estimation, HFI max voltage and duty scaling fix 2021-10-16 12:54:33 +02:00
Benjamin Vedder b1f564c3bb
Merge pull request #352 from kubark42/convenience_math
Use convenience macros for deg/rad conversions
2021-10-15 22:35:47 +02:00
Benjamin Vedder d8a99fd0f1 Inductance and resistance measurement and scaling fixes, various other fixes 2021-10-15 22:25:07 +02:00
Kenn Sebesta bec06ac85a [Utils] Change convenience multiplication factors into convenience MACROs 2021-10-13 14:18:05 -04:00
Kenn Sebesta aeb5d74488 [Utils] Use convenience macros for deg/rad conversions 2021-10-13 11:52:04 -04:00