Skip to content

Adding Interleaved Sampling for 2X Sample Rate improvement #68

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

Open
jmdodd95682 opened this issue Mar 27, 2024 · 4 comments
Open

Adding Interleaved Sampling for 2X Sample Rate improvement #68

jmdodd95682 opened this issue Mar 27, 2024 · 4 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@jmdodd95682
Copy link
Contributor

Looking through the Reference Manual for the STM32H7xx I see there is another Dual mode called Interleaved. It seems likely that by putting an input signal into two Analog Input pins (e.g. A0 and A1) and enabling Dual interleaved mode it will be possible to sample at twice the current maximum rate. So, instead of say 2.9MS/sec we can reach 5.8MS/sec at 16b resolution.

Also, one can also enable a single DMA to handle this dual interleaved data so that all the captured data needs to re-arranging once retrieved from the DMA buffers.

I'm going to try some experiments and see if it works.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Mar 27, 2024
@iabdalkader
Copy link
Collaborator

iabdalkader commented Mar 28, 2024

Also, one can also enable a single DMA to handle this dual interleaved data so that all the captured data needs to re-arranging once retrieved from the DMA buffers.

Yes a single DMA channel can be used in all dual modes, to read the combined sample register. However, I read on the forums that this may be broken, the two halves of the register go out of sync, and more importantly, I don't think we'll be able to reuse the code that we have. So I think this is secondary, not very high priority improvement.

I see there is another Dual mode called Interleaved.

You can add a mode argument to ADCDual, and implement more modes if you like.

@jmdodd95682
Copy link
Contributor Author

jmdodd95682 commented Mar 28, 2024 via email

@jmdodd95682
Copy link
Contributor Author

I have the 2x sample rate using interleaved Dual mode working. I can now sample up to 9.2MS/sec at 8b resolution (5.8MS/sec @ 16b res). I want to do more testing before I do a pull request. I would also like to test the unified DMA which, as you said, probably will not work reliably.

Very cool though. I should be able to make a pretty good capture scope app with this.

@iabdalkader
Copy link
Collaborator

iabdalkader commented Mar 30, 2024

Thanks @jmdodd95682 excellent work!

. I would also like to test the unified DMA which, as you said, probably will not work reliably.

For reference, here's the post that mentions that issue: https://community.st.com/t5/stm32-mcus-products/stm32h7-adc-dual-mode-simultanious-mode-problem/td-p/294976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

3 participants