-
-
Notifications
You must be signed in to change notification settings - Fork 196
Sync PWM implementation with upstream Klipper #799
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
base: main
Are you sure you want to change the base?
Conversation
This reverts commit d5f1588.
This reverts commit aea0278.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
To support the cartographer, it is required to output 24 MHz. With current defaults max output frequency is: 48 MHz/256 = 187.5 KHz Adjusting the PWM scale allows for ramping up the frequency. To not mess up with existing PWM users, define the STM32-specific command. Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
I tried this on the STM32F072 chip on the ALPS board. It needs PA3 to generate an 8MHz clock signal. With the config: Results in the error: This is because the default clock for PA3 is TIM2, which is klipper's own reference clock. This gets set up before any gpio pins and so its prescaler is already configured. This used to be OK because you couldn't reprogram the prescaler, and it still is OK for some PWM frequencies. Fixing this in this case means using a timer that's not going to conflict with klipper's main clock. In this case changing this line from: to: This is not a hardware capability problem, this is just a software limitation. So how to go about more robustly solving that. Should the software know about alternate timers on a pin and automatically use them when there is a conflict with the primary timer? I.e. have a list of timers and try them in a loop: Then it would only error out when all of the timers on the pin have been programmed. FWIW @nefelim4ag |
|
As I mentioned in the discord. Generally, I think the rule of thumb we care about practical application. Cheers, |
|
Doing this on an ad-hock basis for each board we try to adopt could work, but its tedious, error prone & prone to accidental reverts. Having a list of alternate timers would make things a lot more predictable and not require any edits in the future. It would restore control to the user via the On the negatives side:
I can do the one off PR but I don't love that as a generalized answer. |
|
Either way, ship this change! 🚢 |
This PR reverts #701 and cherry-picks Klipper PR #7091, as both provide similar functionality. Aligning with #7091 makes it significantly easier to stay in sync with upstream Klipper going forward.
It also includes Klipper PR #7158 and commit 7377da63b7b1ca4b62fb7d843b57224f332b37c7.
Klipper PR #7156 was intentionally skipped, as it is superseded by PR #7158.