arch/stm32h7: Add DAC/DMA driver#19539
Open
seniorandre wants to merge 3 commits into
Open
Conversation
+ added dac driver * modified Kconfig for DAC, DAC_DMA, TMX_DAC * checked DMA+DAC/DAC only * checked DCASH/wo DCASH * checked TIM 1,2,4,5,6,7,8,15 Signed-off-by: Andrey Sobol <andrey.sobol.nn@gmail.com>
seniorandre
requested review from
davids5,
jerpelea,
michallenc and
raiden00pl
as code owners
July 25, 2026 20:18
acassis
approved these changes
Jul 26, 2026
Contributor
|
@seniorandre please fix: ../nuttx/tools/checkpatch.sh -c -u -m -g 216edd7..HEAD |
Add DMA support for DAC output with configurable double-buffering via ioctl interface: - ANIOC_DAC_DMABUFF_INIT: Copy full buffer into DMA buffer (memcpy) - ANIOC_DAC_DMA_START: Start DMA with optional half-transfer interrupts - ANIOC_DAC_DMA_STOP: Stop DMA and timer - ANIOC_DAC_DMA_GET_EVENT: Wait for half-transfer complete event - ANIOC_DAC_DMA_WRITE_HBUF: Write half-buffer into DMA buffer - ANIOC_DAC_INFO: Query DAC capabilities (resolution, DMA, buffer size) Stream mode: when halfint=1, both HTIF and TCIF generate events via a ring buffer and semaphore. User writes the completed half while DMA fills the other half. TCIF indicates h=1, HTIF h=0. DMA priority is configurable per-channel via Kconfig choice (Low/Medium/High/VeryHigh), defaulting to Medium. Signed-off-by: Andrey Sobol <andrey.sobol.nn@gmail.com>
Covers basic write mode, DMA circular and stream modes with code examples, data structures, ioctl commands, and Kconfig configuration. Signed-off-by: Andrey Sobol <andrey.sobol.nn@gmail.com>
seniorandre
force-pushed
the
stm32h7-dac-dma
branch
from
July 26, 2026 07:32
1e0a818 to
f05063a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a lower-half DAC driver for the STM32H7 on-chip 12-bit DAC peripheral with three operating modes:
DMA stream mode exposes ioctl commands:
Basic write mode uses software trigger (SWTRIG); DMA modes use a timer (TIM1–8,15) as the DAC trigger source.
Kconfig (Low/Medium/High/VeryHigh).
Busy/poll-free event path via semaphore synchronization.
Also included:
Impact
Testing
Config parameters:
CONFIG_DAC=y
CONFIG_STM32_DAC=y
CONFIG_STM32_DAC1=y
CONFIG_STM32_DAC1CH1=y
CONFIG_STM32_DAC1CH2=y
CONFIG_STM32_DAC_LL_OPS=y
CONFIG_STM32_DAC1CH1_DMA=y
CONFIG_STM32_DAC1CH1_DMA_BUFFER_SIZE=4096
CONFIG_STM32_DAC1CH1_DMA_PRIORITY_MEDIUM=y
CONFIG_STM32_DAC1CH1_TIMER=5
CONFIG_STM32_DAC1CH1_TIMER_FREQUENCY=100000
CONFIG_STM32_DAC1CH2_DMA=y
CONFIG_STM32_DAC1CH2_DMA_BUFFER_SIZE=4096
CONFIG_STM32_DAC1CH2_DMA_PRIORITY_MEDIUM=y
CONFIG_STM32_DAC1CH2_TIMER=6
CONFIG_STM32_DAC1CH2_TIMER_FREQUENCY=100000
CONFIG_STM32_DMA1=y
CONFIG_STM32_TIM=y
CONFIG_STM32_TIM5=y
CONFIG_STM32_TIM6=y
CONFIG_EXAMPLES_DAC=y
Results: