-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
Prototype STM32 Auto Timer Selection #20514
Prototype STM32 Auto Timer Selection #20514
Conversation
I removed all the timer overrides that were using this HAL. I will need to go back and carefully review them to be sure they are likely to work with automatic selection. |
I will using this comment to evaluate the boards that previously had overrides, along with some other common boards.
|
I have decided to discard this change for now. It was educational for me and I think I have it working well. The problem is that until we can determine the timers being used by fans and other PWM pins, we cannot safely auto-select timers at build time. I will probably keep some of these changes, to improve the debugging experience when users have timer conflicts, but remove the auto-selection portion of the code. I will then add new timer overrides to pins files where they are needed. |
can y tell what files or lines need to fix it, I have same problem on lerdge K on older version. |
Description
This is experimental. Not yet tested AT ALL.
I am posting it to see how the CI run goes. If that is successful and my own tests go well I will invite others to try it.
STM32 timer conflicts are an ongoing issue. This is worsened as we move STM32F1 boards into the STM32 HAL, since the default timers used were not always the same between the two HALs. There is significant variety in timer selection in the STM32F1 variants, making selection of defaults difficult.
This change seeks to automatically select timers at build time. This considers enabled features, variant.h definitions, and pin-file overrides. Combining these with lists of preferred timers for each MCU family allows unused timers to be selected.
If no available timers can be located in the MCU-specific preferred list, it falls back to a default preferred list. These are ordered loosely based on the likelihood of them being already used.
Benefits
Reduce the occurrence of timer conflicts when features are enabled for new boards. Can likely eliminate existing overrides as well, but this will have to be done with care.
Current drawbacks
Selection is all being done using the timer's base address as the unique identifier. This makes it hard when debugging to know which timer numbers they correlate to. I would like to see if I can rework this to make it easier to see the actual timer number, rather than a base address.
As with previous solutions, this does not factor in PWM outputs, such as fans, RGB LEDs, and lasers.
Configurations
I posted some updated customer configs as a comment in #20387. These produced timer conflicts prior to this change, and now compile.
Related Issues
This has come up multiple times, but this is the issue I am working with directly.
#20387
#20527