Skip to content

cpu/sam0_common: fix DAC on SAM D5x/E5x #21548

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

Merged
merged 2 commits into from
Jun 11, 2025
Merged

Conversation

benpicco
Copy link
Contributor

Contribution description

When writing data too quickly on SAM E54, the DAC driver would hang on while (DAC->SYNCBUSY.reg & mask) {}.

The errata sheet suggests to check for INTFLAG.EMPTY instead when using internal reference, so just do that.

Also use the internal voltage reference by default on same54-xpro to avoid seeing no output at all when using the external reference (and not connecting it to Vref, which is a pretty obscure thing to do).

We only get a 1V amplitude, but that's still better than 0V.

Testing procedure

tests/drivers/dac_dds produces a neat sine wave for 2s with sine 440 2.

Verified this both on same54-xpro and samd21-xpro to avoid introducing a regression there.

Issues/PRs references

@benpicco benpicco requested review from dylad and keestux as code owners June 10, 2025 17:41
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports labels Jun 10, 2025
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 10, 2025
@benpicco benpicco requested review from maribu and HendrikVE June 10, 2025 17:42
@crasbe crasbe added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jun 10, 2025
@riot-ci
Copy link

riot-ci commented Jun 10, 2025

Murdock results

✔️ PASSED

22cdbde boards/same54-xpro: default to internal voltage reference for DAC

Success Failures Total Runtime
10379 0 10379 10m:33s

Artifacts

@maribu maribu added this pull request to the merge queue Jun 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 11, 2025
benpicco added 2 commits June 11, 2025 13:06
Using the external reference produces no output when no voltage is
connected, which makes for a confusing non-functional DAC on the eval
board.
@crasbe crasbe added this pull request to the merge queue Jun 11, 2025
Merged via the queue into RIOT-OS:master with commit 18c666a Jun 11, 2025
25 checks passed
@benpicco benpicco deleted the cpu/samd5x-dac branch June 11, 2025 14:12
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants