-
Notifications
You must be signed in to change notification settings - Fork 1.3k
embassy-rp: enable access to low-level PIO registers and values #5122
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: main
Are you sure you want to change the base?
Conversation
This value is required to configure DMA to/from the state machine FIFOs, so granting access to the value is useful if a program wants to do things embassy-rp doesn't support yet (such as chaining DMA channels).
These values are needed to manually configure DMA transfers in or out of a PIO state machine FIFO.
Register access is useful when debugging PIO issues, such as stalled FIFOs or state machines waiting for irqs.
|
Ideally, the high level interface (of both DMA and PIO) would be expanded to cover your usecase. The pac version is not bound to the semver of embassy-rp, so I think we cannot put registers in the public interface of embassy-rp. |
Thanks for the feedback! PIO+DMA can be combined in so many ways, that unless we have a bunch of applications to look at, it seems pretty hard to guess at an interface that supports a wide variety of use cases. And since any high-level interface has to meet semver requirements, it can't evolve very quickly if it needs to wait for a new breaking release every time a change needs to be made. So I imagine it would be easier (both for downstream projects and for embassy-rp semver-compatibility) to allow people to do what they want with the PIO registers and then look for common patterns in the projects that result. I'm open to being proved wrong! I'm just not sure how to gather more information from the current state of things.
That's good to know. I'm confused though by the existence of |
|
All true, I think the best we can do is expand it as new uses come up. Since we're not 1.0 yet, I wouldn't worry too much about making breaking changes, so long as the new API's capabilities are a superset of the old one.
Good catch, I think this might just be a mistake. A middle ground has just occurred to me. The pac is re-exported with the |
I think this PR is dependent on the answer to that question. If embassy-rp is going to allow dropping down to a lower level by calling e.g. If embassy will not allow this, and If dropping down to rp-pac will not be allowed, then I think embassy-rp will need some new DMA capabilities to replace the power that was just taken away. The DMA hardware is pretty expressive, so it would be a big task to express all of its capabilities in a safe high-level interface. I'm also not sure if the end result would be any easier to use than rp-pac registers. If this is the way you want to go I could try to get things moving by writing up a description of the problem with some examples. |
That would be fine with me. |
Existing code doesn't really support using PIO with complex DMA configurations (e.g. chaining dma channels to automatically loop buffers).
I found that there were a few things I wanted from embassy-rp to make these designs easier:
I have been dropping down to
rp-pacto do these things, but that fits poorly with the rest of my (embassy) code, and breaks down when using generic parameters for the pio and sm instances.Feedback welcome! Feel free to bikeshed names, docs, etc.