From 8873df242135bc274cb66d4b7d456ea710e36690 Mon Sep 17 00:00:00 2001 From: Simon Kirby Date: Sun, 19 Jan 2014 00:29:10 -0800 Subject: [PATCH] Limit zero crossing filter backtracking, take 3. Take 2 in d58be3e357 made some motors better and other cases, like the MT3506, worse. It is a little sad how much logic is required, but I have tried for weeks to find a more simple approach. Nothing else is able to work as well as this with all of the motors I have to test. Previously, the demagnetization path disabled power only during the zero crossing wait. This did reduce the amount of current slightly, which did help, but in many cases the timeout would keep recurring for some time, reducing output power until the back-EMF was high enough. We now disable power and align, which allows for faster acceleration even with timeouts. The remaining timeouts can probably be solved by a smoother timing_duty limit. This also restores the 240 degree zero crossing timeout which helps with motors with unbalanced windings and the ZMR RCX 1804 2400KV. --- tgy.asm | 77 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/tgy.asm b/tgy.asm index 3d2ac87..24a7771 100644 --- a/tgy.asm +++ b/tgy.asm @@ -240,6 +240,8 @@ .equ ENOUGH_GOODIES = 12 ; This many start cycles without timeout will transition to running mode .equ ZC_CHECK_FAST = 12 ; Number of ZC check loops under which PWM noise should not matter +.equ ZC_CHECK_MAX = POWER_RANGE / 32 ; Limit ZC checking to about 1/2 PWM interval +.equ ZC_CHECK_MIN = 3 .equ T0CLK = (1<