fix: audio dac (enters a loop while playing trims)#7463
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Is this the same problem of PR #7274 ? |
I believe so, yes - or at least the PA01 and v12 have shown exactly same symptoms for the past several months. |
|
seems both fixes are necessary, and these 2 are for dma underrun in H7 radios, I am tracking similar problem in F4 radios, which is a regression bug from 2.10 -> 2.11 |
|
My AI coder gives this comments for both PRs: H7 DAC Audio DMA — PR #7274 vs PR #7463 ComparisonContextBoth PRs target the H5/H7/H7RS circular double-buffer DMA path in Neither PR affects the F4 path (PL18, Taranis, etc.) — they are H7-only fixes. PR #7274 — "chore(radio): audio related DMA cleanup" (SchrodiL)Problem solvedDMA thrashing: the old code stops DMA immediately when a single buffer half runs empty, then the audio task restarts it on the next cycle. This causes rapid stop/start jitter and audio gaps during brief buffer starvation (e.g., a flash page read that takes 1-2ms). SolutionAdds a starvation hysteresis counter
Additional changes
TradeoffDuring the hysteresis window, if the audio producer is genuinely starved for >30ms, the circular DMA replays stale data from the other half-buffer for up to 30ms before stopping. This means a flash erase (45-400ms) still eventually stops cleanly, but there's a brief stale-audio period. PR #7463 — "fix: audio dac (enters a loop while playing trims)" (3djc)Problem solvedWhen DMA is stopped mid-transfer and restarted, the hardware registers Solution
Additional changes
Side-by-side comparison
Behavioral traceVerdict
Conclusion: They are complementary, not competing. PR #7463 ensures DMA never desyncs on restart. PR #7274 prevents unnecessary restarts in the first place through hysteresis. Both should be applied — #7463 first for the bug fix, then #7274 merged on top with the The merged result would give:
|
In some circumstances, the audio can enter in 'loop' state, as show in video
Video_1781608013802_110.mp4
This fixes it.
While I have bot been able to reproduce on main, I would think main needs it too (I have done PR on 2.12 since I could reproduce issue and confirm fix)