Skip to content

Add alternate clock configurations for STM32#849

Open
garethky wants to merge 2 commits intoKalicoCrew:mainfrom
garethky:pr-alps-clock-config
Open

Add alternate clock configurations for STM32#849
garethky wants to merge 2 commits intoKalicoCrew:mainfrom
garethky:pr-alps-clock-config

Conversation

@garethky
Copy link
Copy Markdown
Contributor

@garethky garethky commented Mar 1, 2026

On the Mellow ALPS ADS131M02 board they used PA3 as the clock input pin to the ADC. In the existing chip config this pin is assigned to the same clock as klipper's main timer. This causes a conflict when trying to use the new [static_pwm_clock] feature to set up that pin to cycle at 8Mhz.

This PR introduces a new feature that can try multiple pins definitions in the config until it finds one that can be programmed successfully without a conflict. This means that the alternate timers for each pin can be added to the existing config. I add one such config for the ALPS board for PA3 that uses its alternate timer.

Checklist

  • pr title makes sense
  • added a test case if possible
  • if new feature, added to the readme
  • ci is happy and green

@garethky garethky marked this pull request as ready for review March 19, 2026 22:04
@garethky
Copy link
Copy Markdown
Contributor Author

I'm doing all my ADS131M02 testing with the ALPS board that requires this to work. So its been tested to work with that.

Comment thread src/stm32/hard_pwm.c Outdated
Comment on lines 373 to 379
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the inner shutdown calls here became dead code after the refactor?

garethky and others added 2 commits May 5, 2026 12:38
The Mellow ALPS board needs PA3 to emit an 8Mhz signal to drive the ADS131M02's clock input. Unfortunatly this conflicts with klipper's primary timer, TIM2. This change adds an alternate timer function for pin PA3 to allow this pin to emit a clock signal without the conflict using times TIM15.

Signed-off-by: Gareth Farrington <[email protected]>
Each pin has alternate timers. If the primary timer is being used or is already configured with a different time base by another pin, the alternate timer can be used instead. This loopes over the alternate configurations looking for a free timer to configure.

Signed-off-by: Gareth Farrington <[email protected]>
@garethky garethky force-pushed the pr-alps-clock-config branch from 51ee944 to 8ce2b38 Compare May 5, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants