Skip to content
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

use systick-monotonic #501

Closed
jordens opened this issue Feb 3, 2022 · 2 comments · Fixed by #502
Closed

use systick-monotonic #501

jordens opened this issue Feb 3, 2022 · 2 comments · Fixed by #502
Milestone

Comments

@jordens
Copy link
Member

jordens commented Feb 3, 2022

I made rtic-rs/dwt-systick-monotonic#6 and tested on fls (just for the RTIC monotonic, not the SystemTimer Clock for NAL etc).
But I think we should just use systick-monotonic at 1 kHz (which also works fine). wrapping monotonics::now().ticks() might be all we need for Clock.
https://github.com/rtic-rs/systick-monotonic

@ryan-summers
Copy link
Member

Moving some matrix conversation points here:

In order to use the SYSTICK monotonic, we'll need to have a SYSTICK interrupt + ISR handler. This handler will need to execute once per tick rate (e.g. at 1KHz tick rate, ISR will run every 1ms).

This ISR can either be higher or lower priority to the DSP process:

  • If higher priority, the ISR must be short enough to not interrupt DSP process() timing requirements
  • If lower priority, the DSP process() routine must always be shorter than the tick period for all possible batch sizes

@ryan-summers
Copy link
Member

ryan-summers commented Feb 3, 2022

The current DSP process() shortest allowable time is with a batch size of 1 at the full 780KHz sample rate, which corresponds to ~1.28uS. This corresponds to roughly ~512 CPU cycles at 400MHz.

If we can show the SYSTICK ISR overhead will fit within that period, we can make the SYSTICK a higher priority. If not, we'll have to make the SYSTICK a lower priority and add a caveat that the process() routine must always be shorter than the timer tick rate.

I think trying to guarantee that the ISR will fit within those 512 clock cycles would be tricky, so it's likely the best path to set the SYSTICK rate to something decently long and add a compile-time check to ensure that the batch capture period is shorter than the systick duration

@jordens jordens mentioned this issue Feb 4, 2022
2 tasks
@bors bors bot closed this as completed in 3fb2932 Feb 10, 2022
@jordens jordens added this to the 0.6 milestone Feb 10, 2022
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 a pull request may close this issue.

2 participants