Skip to content
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

Dynamic PWM, smoother commutation #73

Closed
wants to merge 18 commits into from
Closed

Conversation

damosvil
Copy link
Contributor

@damosvil damosvil commented Feb 24, 2023

Features in this version:

  • Dynamic PWM
  • Add arming when edt enable safety feature
  • Configurable rcpulse filtering to mitigate desyncs and stalls caused by poorly PID tunnings
  • Timer1 interrupt was stuffed, so it penalized commutation. Now the load is moved to a new state machine the like of dshot_tlm_create_packet. Both stms are interrupted when timer3 triggers. Now commutation is smoother.
  • dshot_tlm_create_packet has been demistified removing obstructing macros and optimized using a jump table.

Demag and stall events notification flag cleared during dshot configuration

Fixed 640ms scheduler step

Updated status frame to carry demag metric max, and demag, desync and stall event flags

Fixed stall bug

Added clear for demag metrix max

Scheduler has been rewritten and optimized to allow sending demag metric every 64ms and temperature, status, debug1 and debug2 every 256ms

Demag_Detected_Metric_Max scaled to take full advantage of 4bit, small optimization in temperature PWM limit to follow Temp_Pwm_Level_Setpoint

Improved comment in stat frame

Fixed max demag event load for the case it is below 120 (should happen only when motors are stopped)

Clear notification flags after sending status frame

Updated .gitignore

Fixed review findings

Rebased to develop

Set default power rating to 2S+
Fixed calculate_pwm_bits

Fixed calculate_pwm_bits function

Fixed some compiling errors

Fixed format

Fixed whitespaces

Merged latest edt_events changes

Optimized t1_int pwm bitN code paths
Added missing bits to update PWM cycle length

Fixed several bugs

Added low and hight variable pwm rc pulse thresholds

Fixed some bugs

Added DYNAMIC pwm option to build.sh script and Makefile
Updated comment

Minor refactory

Bumped layout revision to 207

Explained calculate commutation period
Fixed calc_next_comm_period_fast.
Optimized calc_next_comm_period.

Fixed a bug

Fixed a bug
@damosvil damosvil self-assigned this Feb 24, 2023
@github-actions
Copy link

Build artifacts:

@damosvil damosvil force-pushed the pwm_deadtime_correction branch from 03bd9ce to 5f731d0 Compare February 25, 2023 08:33
@damosvil damosvil changed the base branch from main to rework/calc_next_comm_period February 25, 2023 08:35
@damosvil damosvil linked an issue Feb 25, 2023 that may be closed by this pull request
@github-actions
Copy link

Build artifacts:

@damosvil damosvil force-pushed the pwm_deadtime_correction branch from 5f731d0 to a9b6e36 Compare February 25, 2023 18:28
@damosvil damosvil force-pushed the pwm_deadtime_correction branch 15 times, most recently from 24d490f to efcf8d1 Compare March 4, 2023 22:01
@damosvil damosvil changed the title Pwm deadtime correction Dynamic PWM and other goodies Mar 4, 2023
@damosvil damosvil marked this pull request as ready for review March 4, 2023 22:11
@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

…frame reading program flow. Now Int0 interrupt is enabled after reading dshot frame start time in Int1 interrupt to avoid false positives. This commit prepares Isrs's module for a new commit to make rcpulse processing deterministic.

Removed B register from context saving in timer1 interrupt, because it is no longer used there
@damosvil damosvil force-pushed the pwm_deadtime_correction branch from 56c85b1 to 11d5944 Compare April 22, 2023 07:46
@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@damosvil damosvil force-pushed the pwm_deadtime_correction branch from 95fc552 to 661656b Compare April 23, 2023 06:47
@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@github-actions
Copy link

Build artifacts:

@damosvil
Copy link
Contributor Author

damosvil commented Jun 6, 2023

This pr is closed because the strategy to reduce the time t1_int takes to run is based in splitting the routine in a rcpulse state machine and run it during timing routines waits for timer3 to expire. The problem with this approach is that it works fine at high rpm (because each phase cycle is shorter), but at low rpm zero cross scan takes much longer (during that time the rcpulse state machine cannot be executed) so throttle response is reduced causing wobbling.
In addition most of the commits relared to this version are squashed, so it is not possible to track and review changes separately, difficulting teamwork.

We plan to implement dynamic pwm and other features in newer 0.20 banch, in an orderly manner. We will keep this branch as an investigation work and as a source to know the changes to be done to implement variable PWM, and other features.

@damosvil damosvil closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Motor twitching around 83000rpm
2 participants