-
Notifications
You must be signed in to change notification settings - Fork 48
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
Hrtim #70
Hrtim #70
Conversation
src/pwm/hrtim.rs
Outdated
// TODO: Somehow, there is no rstf1r | ||
//HRTIM_TIMF: HrOut1: tf1oen, setf1r, rstf1r, | ||
|
||
// TODO: Somehow, there is no tf2oen | ||
//HRTIM_TIMF: HrOut2: tf2oen, setf2r, rstf2r, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit weird, the reference says there should be a tf2oen
... Is this a bug in the crate stm32g4
? I believe the HRTIM_TIMF
timer might be unique to stm32g474
/stm32g484
thus should be missing in stm32f334
and stm32h7
.
Any thoughts? :) Does the interface make sense? Do you have any suggestions? :) |
* Rcc enable is now handled for the entire HRTIM peripheral by dp.HRTIM_COMMON.hr_control() instead of by every timer * HRTIM calibration is now mandatory, also handled by `dp.HRTIM_COMMON.hr_control()` but also by running on that result `_.wait_for_calibration(). * Add `get_state` for `HrOutput` to check what state an output is in: `Idle`, `Running` or `Fault`
…hey are 'set-only'
@usbalbin does this PR is active? |
I have made a lot more changes in another branch. However that branch also has a lot of unrelated changes so I will at some point try to clean that up and make a new PR. Or more likely a set of new PRs since there is quite a lot hrtim stuff.
So, no. |
This depends on #68 (and thus includes its commits)
Solves: #69
This is still quite messy
and is not yet verified on actual hardware- Done some tests and seems to work, will do more tests soonHRTIM
(desctiption mostly copied from #69, example updated)
From what I understand(correct me if I am wrong) looking at the stm32g474 and stm32g484. We have 6 timers, each timer has two outputs which may be routed to pins. So far it looks just as any other pwm timer, however the waveform for each output is defined by up to 32 event sources. Some of those are the ouput's own timer's compare registers(4) and the period wrap around(1), other than that there are lots of other sources like a selection of other timers compare registers, master timer etc. Safe to say, there is not simply one single set_duty that controls the waveform. Then there are dead time and, faults etc.
With that said perhaps it would be wise to start small with some sort of MVP. What would you think about something like splitting this in to three main types:
HrTimer
- this is where we control the period, and overall timer modes and settingsCompareRegister
- I guess this could implement the PwmPin trait even if it might not necessarily be the "duty" that is controlled withset_duty
in all casesOutput
- This is what owns an output pin, may be used for setting what events to listen to in order to form the wave form.This is now can now be used as:
TODO:
half
mode, maybe