8000 Pio last update by mateir-7 · Pull Request #4212 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pio last update #4212

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

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Pio last update #4212

merged 3 commits into from
Oct 23, 2024

Conversation

mateir-7
Copy link
Contributor

Pull Request Overview

Modified main.rs so pio_pwm doesn't always start + observed with oscilloscope that values under 1 MHz were 3 times as low as they needed to be, fixed.

Note: values over 1MHz do exist but frequency and duty cycle will not be the same as the input ones.

Testing Strategy

This pull request was tested by running the now commented pio_pwm.start function at the end of the main.rs file.

TODO or Help Wanted

No help needed.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

lschuermann
lschuermann previously approved these changes Oct 22, 2024
Copy link
Member
@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

Looks good.

@mateir-7 can you fix the following clippy lint?

error: unused import: `kernel::hil::pwm::Pwm`
  --> boards/pico_explorer_base/src/main.rs:23:5
   |
23 | use kernel::hil::pwm::Pwm;
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

@alexandruradovici
Copy link
Contributor

Can you explain a little bit more the problem and the fixe's limitations?

@mateir-7
Copy link
Contributor Author

Fixed the clippy lint - just forgot to commit yesterday, didn't understand why it failed. About the 3 times lower frequency, I honestly have no idea why that is happening? Only thing that comes to mind is the resistor I used to test it, maybe that could interfere with it? Values over 1 MHz don't work because of how PWM is coded in pioasm. In PIO, the program reads the number of loops that it needs to go through for one PWM cycle and then reads at what loop it is supposed to turn the signal on. This means that the HIGHER the number of loops, the more time it takes for one PWM cycle, meaning LESS frequency. This leads to higher frequencies needing lower number of loops, and at one point the number of loops the program goes through is so low that it can't properly divide it for the exact duty cycle needed. This leads to duty cycles being off. Frequency starts getting off little by little as the value goes higher (most likely) due to the assembly program having 3 clock cycles at the beginning just to get its data and another cycle when it needs to turn on the led, leading to more noticeable "time loss" at higher frequencies. At 1000 cycles, the 4 extra won't be a problem, but at 100 or less cycles it could lead to that - 1 MHz, for example, has 125 cycles.

@lschuermann lschuermann added the last-call Final review period for a pull request. label Oct 22, 2024
@lschuermann lschuermann added this pull request to the merge queue Oct 23, 2024
Merged via the queue into tock:master with commit 9ae0348 Oct 23, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call Final review period for a pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0