-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Rate Groups and Timeliness] RateGroups Docs Enhancements #3398
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: devel
Are you sure you want to change the base?
Conversation
… with a static code block
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.
Pull Request Overview
This PR enhances the RateGroups documentation by correcting a grammatical error and adding a detailed example for a clock prescaler algorithm using Svc core module components.
- Corrected grammatical error in the description.
- Added a new example section illustrating a clock prescaler algorithm, complete with code excerpts.
Files not reviewed (1)
- .github/actions/spelling/expect.txt: Language not supported
Let me know if there is something needs to be done to get this approved. |
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.
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- .github/actions/spelling/expect.txt: Language not supported
Co-authored-by: Copilot <[email protected]>
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.
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- .github/actions/spelling/expect.txt: Language not supported
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.
I looked through this PR, and I see where you are coming from. I made some requests for clarifications, because all of this happens in software.
I really like the analog with the prescaler.
Thanks!
@@ -25,6 +25,44 @@ system clock and the port call to rate group driver's `CycleIn` port. | |||
The reference application calls the `CycleIn` port followed by a sleep for the system clock time within a while loop to | |||
simulate a system-driven clock. | |||
|
|||
**_Example_**: Recall a crystal oscillator running at 1000 HZ (or 1 MHZ), then a system clock source would sample each 1MHZ. Recall that a `RateGroupDriver` is registered to this system clock source sampler that requires to be updated at a rate of 100HZ; therefore the following applies: |
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.
I'd recommend this:
- "Consider a system clock driven at 1000Hz by a crystal oscillator and a rate group needing to run at 100Hz".
@@ -25,6 +25,44 @@ system clock and the port call to rate group driver's `CycleIn` port. | |||
The reference application calls the `CycleIn` port followed by a sleep for the system clock time within a while loop to | |||
simulate a system-driven clock. | |||
|
|||
**_Example_**: Recall a crystal oscillator running at 1000 HZ (or 1 MHZ), then a system clock source would sample each 1MHZ. Recall that a `RateGroupDriver` is registered to this system clock source sampler that requires to be updated at a rate of 100HZ; therefore the following applies: | |||
* On the API layers level, both drivers; the `SystemSourceDriver`, and the `RateGroupDriver` shall be implementations of F' components; thus they could only communicate via ports (e.g., commands, events, and telemetry channels). In this case, the implementation could be taken towards commanding. |
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.
- Remove "On the API layers level"
- "Both drivers,
SystemSourceDriver
, and theRateGroupDriver
, are F´components" - Remove "(e.g., commands, events, and telemetry channels). In this case, the implementation could be taken towards commanding."
@@ -25,6 +25,44 @@ system clock and the port call to rate group driver's `CycleIn` port. | |||
The reference application calls the `CycleIn` port followed by a sleep for the system clock time within a while loop to | |||
simulate a system-driven clock. | |||
|
|||
**_Example_**: Recall a crystal oscillator running at 1000 HZ (or 1 MHZ), then a system clock source would sample each 1MHZ. Recall that a `RateGroupDriver` is registered to this system clock source sampler that requires to be updated at a rate of 100HZ; therefore the following applies: | |||
* On the API layers level, both drivers; the `SystemSourceDriver`, and the `RateGroupDriver` shall be implementations of F' components; thus they could only communicate via ports (e.g., commands, events, and telemetry channels). In this case, the implementation could be taken towards commanding. | |||
* On the hardware level, the `SystemSourceDriver` shall use a clock divider that drives the `RateGroupDriver` each $$\frac{100HZ}{1MHZ}$$ of the system source sampler (i.e., at a rate of $$\frac{1}{10}$$ of the system source sampler). |
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.
Remove "On the hardware level". All rate group items are handled in software.
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.
I understand the architecture of the RateGroupDrivers. In this part, I was willing to describe what happens during the runtime, which is really hardware and not Rate Groups anymore. Do you recommend a better introductory word?
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.
So, this explanation is considered a text-based deployment model.
**_Example_**: Recall a crystal oscillator running at 1000 HZ (or 1 MHZ), then a system clock source would sample each 1MHZ. Recall that a `RateGroupDriver` is registered to this system clock source sampler that requires to be updated at a rate of 100HZ; therefore the following applies: | ||
* On the API layers level, both drivers; the `SystemSourceDriver`, and the `RateGroupDriver` shall be implementations of F' components; thus they could only communicate via ports (e.g., commands, events, and telemetry channels). In this case, the implementation could be taken towards commanding. | ||
* On the hardware level, the `SystemSourceDriver` shall use a clock divider that drives the `RateGroupDriver` each $$\frac{100HZ}{1MHZ}$$ of the system source sampler (i.e., at a rate of $$\frac{1}{10}$$ of the system source sampler). | ||
* On the hardware implementation level, this could be done via many approaches; a counter algorithm (that triggers an interrupt when reaching 100 cycles resetting the `numberOfCycles` each second) can suffice or a more complex modular arithmetics algorithm could be used (e.g., $$((ticks\ mod\ rate)\ ==\ offset) \implies CycleOut$$; where `ticks` represents the current system virtual clocks, `rate` represents the `RateGroupDriver` required frequency, and `offset` represents the remainder of the value at which sampling shall occur when the system clock `ticks` reaches the requested `rate`; Zero `offset` means that the system source sampler will sample this driver when it reaches an integer multiple of its requested `rate`). |
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.
Here I would just state "In the provided Svc/RateGroupDriver this is done by counting up to a configured number of cycles before emiting the divided signal". Link to the source code.
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.
So, what do you recommend regarding this bullet point? I'd like to describe each variable used, but simply. It was best to do this via a logical implication formula (which summarizes what the algorithm does).
Svc
core module.Change Description
The First Change:
I am completely new to F-Prime, but I've some good experience in embedded systems design in general. I was reading the RateGroups and Timeliness documentation when I stepped into a grammatical error, and I've corrected it in this PR.
The Second Change:
At the first glance, I didn't understand what does it mean to provide a clock divider until I looked for the code. That's why I've added this example.
This change involves an example for the algorithms that could be used to implement a Virtual Clock Prescaler (And, I believe there is more). The example simplifies the operations of Cycling and Sampling performed by the core routine
Svc::RateGroupDriver::CycleIn_handler(...)
.Rationale
I believe this example would be a great add to this page; as it also describes the core algorithm used here to design the
RateGroupDriver
components around the System base component. It may immerse the reader, who might be new to F`-prime, into the core quickly, in addition to providing a good example to the RateGroups-Drivers pattern. Let me know if there are requested changes.Future Work
I think referencing more details from the core on the specialized implementation documentation pages would be a good rigorous change, unless these algorithms shall carry breaking future changes. What do you think about that? Also, another thing, maybe examining whether there are other clock prescaler algorithms?