Repository navigation
Configure audio on STM32F746G-DISCO: dmsai and dmwm8994 - #124
Merged
Merged
Conversation
Load the WM8994 codec stack on the board: dmsai (SAI2 stream) and dmwm8994 with codec-with-touch.ini. That config joins the touch panel's I2C3 bus node instead of configuring I2C3 a second time, so touch and audio work at once. The nodes are /dev/wm8994 (codec controls and stereo PCM) and /dev/dmsai1 (the SAI stream the codec drives). Emulation: DMBOOT_RENODE_AUDIO_CAPTURE=<file> loads the audio models of configs/renode/STM32F7_Audio.cs (SAI2, the WM8994 on I2C3 and a DMA2 with circular mode and half-transfer interrupts) and writes what the codec plays to the file as raw stereo s16le. DMA2 is replaced before the SD card setup, which connects to it by name. Without the option nothing changes in the Renode machine. Needs dmwm8994 with codec-with-touch.ini and dmsai/dmwm8994 releases that implement the dmdrvi 2.7 audio stream commands. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nr1HhezRY951yBxxTm1b65
JohnAmadis
force-pushed
the
ccr-0ed2b297-4zti6v
branch
from
October 11, 2026 10:31
9511752 to
9e69217
Compare
JohnAmadis
marked this pull request as ready for review
October 11, 2026 10:37
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
Loads the WM8994 codec stack on STM32F746G-DISCO. The nodes are:
/dev/wm8994: codec controls and stereo PCM;/dev/dmsai1: the SAI2 stream the codec drives.An application plays through
/dev/wm8994with theDMDRVI_IOCTL_AUDIO_*commands (dmdrvi 2.7):AUDIO_CONFIGURE,AUDIO_START,write,AUDIO_DRAIN,AUDIO_STOP.Draft:
codec-with-touch.iniis not in a dmwm8994 release yet. See "Before this can merge".Changes
configs/board/stm32f746g-disco/flash.dmd: addsdmsaianddmwm8994 driver=board/stm32f746g-disco/codec-with-touch.ini.dmsai_port,dmclk_portanddmdmacome in through dmsai's dependencies.codec.iniconfigures I2C3, so it cannot be loaded next totouch.ini.codec-with-touch.ini(new, in dmwm8994) has the SAI2 pins, the SAI node and the codec but no I2C3 pins or bus. It joinstouch.ini'sfriends_group=lcd, so the codec finds the bus node the touch panel creates. dmi2c gives every client its own handle and serializes the transfers.-DDMBOOT_RENODE_AUDIO_CAPTURE=<file>wires the audio models fromconfigs/renode/STM32F7_Audio.cs(added in Renode models for SAI audio through the WM8994 #122) into the generatedrenode.resc: SAI2, a WM8994 on I2C3 at 0x1A, and a DMA2 with circular mode and half-transfer interrupts. The codec writes what it plays to the file as raw stereo s16le. DMA2 is replaced before the SD card setup, which connects to it by name. Without the option nothing changes in the Renode machine. Documented indocs/cmake-options.md.Before this can merge
codec-with-touch.ini), then a dmwm8994 release that contains it. The currentv0.1does not, sodmf-getlogsConfiguration file not found: …/codec-with-touch.iniand the board would boot without the codec config. The firmware builds still pass.v0.1and dmwm8994v0.1are released and already implement the dmdrvi 2.7 audio stream commands; nothing is needed there.CI: "Test Renode Simulation" is red here, and on
masterIt is not caused by this PR.
masterhas been red since 08:44 UTC with the same failure at step 5:✗ echo prints its argument: no prompt after 'echo uart-test-…'. The firmware prints the shell prompt but never answers input, and all later steps (SD, LCD, touch, network) are skipped.I compared the module versions
dmf-getresolved in the last green run (PR #123, 08:34) and the first red one (master, 08:44). Only three differ:dmuart1.1 → 1.1.1,dmuart_port1.1 → 1.1.1 anddm_sw_ring0.5 → 0.6. Pinning versions locally in a build ofmaster(no change from this PR), then booting in Renode:So
dmuart_port1.1.1 is the cause (dm_sw_ring0.6 was used in all four rows). I do not know whether it also affects the real board or only Renode's USART model; I could not look at the dmuart repository from here.dmuart_port@1.1pinned inconfigs/common/flash.dmdwould get CI green again as a stopgap; I have not added it.Verification
Done with the released dmsai v0.1, dmwm8994 v0.1 and the current dmdevfs 1.5 fetched by
dmf-get, pluscodec-with-touch.inifrom the dmwm8994 PR, anddmuart_port1.1 pinned to get around the regression above. Therenode.rescwas generated by this PR's CMake with-DDMBOOT_RENODE_AUDIO_CAPTUREand-DDMBOOT_RENODE_SDCARD./dev/dmi2cx,/dev/dmsai1,/dev/touchand/dev/wm8994all appear./dev/wm8994with a generic player that uses only the dmdrvi audio commands. The codec model received it with no dropouts; the only underruns were the drain tail.touchtest readreports the injected touch correctly (240,136), and a file is written and read back on the SD card (/mnt/DMODTEST), with DMA2 replaced by the audio model.scripts/run_renode_tests.shend to end, and nothing on the physical board.Note: playback is sensitive to other work
During playback, shell activity makes short dropouts. In Renode:
echogave 3 dropouts (1.2–2.7 ms);touchtest read(each loads a module) gave 9 dropouts, up to about 6.7 ms.The SAI queue plus DMA buffer hold about 8 ms and the FreeRTOS tick here is 100 Hz (10 ms). This is unrelated to the shared bus, and I have not yet isolated the cause.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Nr1HhezRY951yBxxTm1b65