-
Notifications
You must be signed in to change notification settings - Fork 7k
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
STM32: Add DMA+ADC support #39640
Comments
Strong request |
Which ADC driver in particular? |
@henrikbrixandersen I needed this specifically for STM32 (I ended up implementing it with HAL), but grepping for "DMA" in the ADC driver directory yielded that no driver implements this currently |
That's not entirely true. The |
Any updates on this? |
Hi all. I have an implementation almost ready to go, but I have some questions.
|
Great ! Thanks for working on this
It should be an alternative. Ideally both versions should coexist with the minimum overlap.
Let's keep it simple: Go ahead and overwrite the device tree values |
Thanks for the feedback @erwango. What is your recommendation for organizing this? A separate file, conditional compilation of the current file, a combination of both? Sometime else? |
My preference goes to the easier to maintain, ie:
These are generally going in opposite direction, so there's a trade off to be found, or use of implementation tricks to get best of both. Some questions :
|
@erwango is there a list of currently supported STM32s? |
I think the closest is the list of DTSI files under https://github.com/zephyrproject-rtos/zephyr/tree/main/dts/arm/st |
Device tree is indeed the reference, but my question was specifically around ADC, so look for adc nodes in this location. |
I have a working bit of code that needs a lot of cleanup and generalization away from STM32G4. It also makes a new interface for doing something like #32719 for continuous reading. https://github.com/worldcoin/zephyr/tree/stm32_adc_dma |
@pdietl Thanks, interesting. From what I see this removes IRQ mode, is that correct? |
@erwango yes, but we can add it back or make this configurable maybe. |
It is indeed not possible to remove IRQ mode support. Behavior regarding IRQ mode should be equivalent with or without DMA. |
Good idea. I’ll do this. |
@erwango I also want your opinion on the continuous reading interface. It would be nice to make a change to the ADC public API to support this use-case. Either by adding a new function (as I have) or adding more fields to the |
This should rather be discussed with @anangl as ADC maintainer. I suggest to open a dedicated issue for this purpose. |
Discussion created here: #48478 |
Any updates on this? |
For people interested in ADC+DMA: |
#52965 is now merged. Closing |
Is your enhancement proposal related to a problem? Please describe.
To sample relatively high frequency signals with an ADC, integration with a DMA is needed. This is not currently supported by the various ADC drivers.
Describe the solution you'd like
The ADC driver could be configured to use a DMA. A buffer is given to the driver, and is filled with samples. The driver will call a user callback when the buffer is (half) full.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: