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

DMA support for PWM #544

Open
peterkrull opened this issue Feb 1, 2023 · 1 comment
Open

DMA support for PWM #544

peterkrull opened this issue Feb 1, 2023 · 1 comment

Comments

@peterkrull
Copy link

Hey all. I want to preface this by saying that I have no experience with hal programming, and have only recently started to study the workings of this crate. I would however like to learn, and possibly help with any implementation.

I have a project where I need to generate a DShot command-signal, where a digital 16-bit frame is encoded using PWM, such that the pulse width determines whether it is a 0 or 1. I am however stuck trying to implement this, since there does not seem to be an implementation of dma::WriteTarget for PWM, which I believe is what I need. Alternatively, I have seen discussions about people trying to implement this protocol using PIO, but I think doing so via PWM would be the more direct approach.

Is this something being worked on? If it isn't, do you think I would bite off more than I can chew if I gave it a go? 😄

@jannic
Copy link
Member

jannic commented Feb 2, 2023

Hi Peter!

You are right, DMA support for the PWM peripheral is still missing from the HAL. I didn't look at it closely, so I might be wrong, but my first impression is that it wouldn't be difficult to implement. You can probably copy the WriteTarget implementation for some other peripheral without huge changes.

In case you want to try the PIO route, the DShot wire protocol does look quite similar to the ws2812 protocol, so https://github.com/rp-rs/ws2812-pio-rs/ might be a good starting point. However it only implements the transmitting side, not the receiving one.

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

No branches or pull requests

2 participants