Skip to content

Read STM32 clock rates from framework#19978

Merged
thinkyhead merged 3 commits intoMarlinFirmware:bugfix-2.0.xfrom
sjasonsmith:PR/Bug18961_TIMER_RATE
Nov 1, 2020
Merged

Read STM32 clock rates from framework#19978
thinkyhead merged 3 commits intoMarlinFirmware:bugfix-2.0.xfrom
sjasonsmith:PR/Bug18961_TIMER_RATE

Conversation

@sjasonsmith
Copy link
Contributor

@sjasonsmith sjasonsmith commented Nov 1, 2020

Description

STM32 timer clock rates are not always constant across a device. Depending on the timer they may be F_CPU, F_CPU/2, or maybe even other values (there are lots of STM32 devices, and I haven't read all their datasheets!).

This change reads the timer's clock rate from the framework, rather than assuming Marlin knows the correct value. This makes our code more generic and easier to implement across the wide range of devices that will be supported by the STM32 HAL.

This also removes the ability to override HAL_TIMER_RATE, which was added for the Rumba32. It is simply no longer necessary.

I tested this on an SKR Pro, by moving the STEP timer to TIMER 10, as does the Rumba32. I both reproduced the original "double step rate" issue seen on the Rumba, then verified that this PR fixes it.

Benefits

  • Eliminates the need to consider timer clock rate when selecting timer assignments.
  • Fixes a babystepping compilation issue, where timers.h depends on a define from timers.cpp.

Configurations

N/A

Related Issues

Fixes: #18961
Replaces former solution for Rumba32: #18374

sjasonsmith and others added 3 commits October 31, 2020 23:31
This eliminates HAL_TIMER_RATE and the need to override them.
@thinkyhead thinkyhead merged commit 4a39c8c into MarlinFirmware:bugfix-2.0.x Nov 1, 2020
@thinkyhead thinkyhead added A: STM32 PR: Improvement T: HAL & APIs Topic related to the HAL and internal APIs. labels Nov 1, 2020
FhlostonParadise pushed a commit to FhlostonParadise/Marlin that referenced this pull request Nov 21, 2020
@sjasonsmith sjasonsmith deleted the PR/Bug18961_TIMER_RATE branch November 23, 2020 09:24
vgadreau pushed a commit to vgadreau/Marlin that referenced this pull request Dec 9, 2020
tharts pushed a commit to tharts/Marlin that referenced this pull request Jan 6, 2021
kpishere pushed a commit to kpishere/Marlin that referenced this pull request Feb 19, 2021
W4tel-BiDi pushed a commit to W4tel-BiDi/Marlin that referenced this pull request Apr 5, 2021
chrisjenda pushed a commit to chrisjenda/Marlin that referenced this pull request Apr 5, 2021
thinkyhead added a commit to thinkyhead/Marlin that referenced this pull request Apr 28, 2021
thinkyhead added a commit to thinkyhead/Marlin that referenced this pull request Apr 29, 2021
thinkyhead added a commit that referenced this pull request Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: STM32 PR: Improvement T: HAL & APIs Topic related to the HAL and internal APIs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants