-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat new cs align #422
Feat new cs align #422
Conversation
Hi @askuric I will have a deeper look when I get home.
|
Hi! I had some problems with the align simply not working reliably with a low resistance (drone) motor. I attribute this to the duty cycle being so low, that the common mode artifacts of the inline sense amps fell into the adc sampling time, thus creating noise. So my setup was inline hardware with lowside sensing configured in firmware (with my modified adc code). What this code change does, is it applies 50% duty cycle (or, more precisely 0.5 * driver_limit) and adds to that the align voltage, thus pushing the pwm edges well out of the adc period. It behaves very much like the normal centered pwm operation we use normally. Since that change, I've had significantly less problems with the alignment. |
Hi guys, thanks for the feedback! @Candas1 very good remarks!
@mcells just as a disclaimer, the old code had quite a few holes algorithm-wise, and there are several cases where the logic would just not work. For example for a long time, the when the pins are switched, the gains and the offsets wouldn't be. I am not sure if this is related to your case, but I just waned to point it out. The new code is more robust and much better tested. :D @mcells I've got a question. Arduino-FOC/src/current_sense/InlineCurrentSense.cpp Lines 48 to 54 in 842b361
|
We have the modulation_centered option, we could reuse it for the current sense align as well ? |
Ok, so I've added both changes:
let me know what you think. |
@askuric I was doing tests on b-g431-esc1 trying all the combinations of current sense pins and _NC
Otherwise so far so good. |
I must say, I really like the new alignment code. It´s now much more polished, both in terms of coding style and verbosity.
* In the hfi fork I was/am having problems with setPWM not updating the registers sometimes, meaning applied voltages sometimes "stick"... But no issues in the stock library. |
This PR introduces a much more robust and verbose current sense alignment. And solves several of the issues that were present in the old version. For example #368
The code sets the voltage first to the phase A and then to the phase B, while measuring the respecting phase currents.
This new code is capable:
_NC
channelsAdditionally it is capable of determining:
The new code outputs more debugging messages and is easier to interpret than the old one.
I've tested the code with several setups and it seems to be much more robust than the old one.
The code is an extension of the PR #421.
There is only one concern that I have with this code and that is the amount of text being printed. Maybe its a bit too much for low memory mcus.