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

[RFC] PIO Based Counter for the RP2040 #269

Open
jbehrensnx opened this issue Oct 30, 2024 · 0 comments
Open

[RFC] PIO Based Counter for the RP2040 #269

jbehrensnx opened this issue Oct 30, 2024 · 0 comments
Assignees
Labels

Comments

@jbehrensnx
Copy link

jbehrensnx commented Oct 30, 2024

Problem description

When testing the drv84xx stepper motor driver on the Cytron RP2040 board, it was discovered, that RP2040 does not include a counter (accessible via the Counter API) that has the required capabilities (setting of a custom comperator value and attaching an ISR to the comperator).

Proposed change

The development of a new counter using the RP2040s PIO that supports these features.

Detailed RFC

This requires he completion of the three following tasks:

  1. Evaluation of the PIO to determine that a counter with sufficient comparator max value can be implemented. A preliminary investigation suggests that this is possible.
  2. Evaluation of the Zephyr PIO integration to determine if it supports all necessary features. Currently the IRQs from the PIO are ignored.
  3. Implementation of the counter using the PIO.

Dependencies

The new counter driver would allow for the development and porting of software that require the setting of comparator values (TOP value) and attaching interrupts to it.
The added interrupt support for the PIO would also allow for the development of software using its interrupts.

The PIO IRQ were already a topic in the following Zaphyr pull requests:
rp2040: Added PIO support
rpi_pico: Added Generic PIO support and a PIO based UART driver

Alternatives

Developing a counter using the PWM hardware of the RP2040 is currently also under consideration. This one is however limited to 16 bit and would not support alarm interrupts.

Points of origin

Our ongoing development of the stepper motor driver drv84xx is a consistent continuation of the results from the following Zephyr upstream RFCs and PRs:

The goal is a generalized STEP/DIR driver based on timers (Counter API and/or PWM API) that can be used on all usable SoCs from different manufacturers. The current focus is on: STMicro (STM32 series), NXP (i.MX RT series), Raspberry Pi Pico (RP2040, possibly also RP235x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants