-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Right channel stops playing audio after a few seconds (samd51) #2099
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
Comments
This sounds related to the "refresh" needed on the SAMD51 DAC's. Their output needs to be refreshed explicitly by forcing a reconversion, or else the charge will decay away. If you put various pulldowns on A1 I have a hunch you'll see it decay faster depending on the value of the pulldown. Turning on refresh is done in I originally fixed this issue in #649. @kevinjwalters mentioned this also in #1991 (comment). |
I will check into that, but doesn't this apply only to static signals? The value is being changed a nominal 100,000 times per second between 0 to 4000 continuously. |
Good point. Is the loss of signal abrupt or does it fade down? Abrupt would sound like a DMA problem (if DMA is being used here). |
abrupt, like DMA stops |
There's also another setting about current ( |
I think the SAMD51 has a pseudo-differential mode for the DAC pair? When I saw that in docs I realised bugs around that area could be a cause of some of these coupling-related oddities but there seem to be so many strange quirks that defy an obvious explanation. I did a quick check of the SAMD21 on a CPX a few months back and it's so clean and predictable! It's as if there's a poltergeist in the SAMD51's DACs. |
I wonder if we should take Malvin's advice and start at the beginning? Even at first use the SAMD51 DACs used from CircuitPython behave strangely with #1991 . Another question is when is the right time to refer an issue to the manufacturer... |
Based on this looking "right" in an Arduino environment, I am hoping there's just some spot of setup that we've missed. Unfortunately, I think I've ruled out everything in the DAC's registers. Moving on to clock setup now, h/t @sommersoft |
You are likely to have already observed it or read it, but when I last looked the DACs weren't clocked fast enough in CP to get the higher rates, 3rd post in https://forums.adafruit.com/viewtopic.php?f=60&t=153797#p759051 I'm wondering if that might be an explanation for a few things. Atmel/Microchip may have done all their testing with the DACs clocked at the top rate as there's little (?) reason to go lower. |
Since #2552 we use just a single DMA channel to send stereo audio (at least when it's 16 bits). This should resolve such problems. If the problem is not resolved with CircuitPython 5.3.0, feel free to reopen this bug. |
While trying to reproduce #1992, I ran into this behvaior instead.
Testing setup: A0, A1 into o'scope. Put some.wav and code.py on CIRCUITPY.
Initially, A0 and A1 both display a signal, but often A1 stops showing signal before A0 even though both halves of the sample should play for the same duration. The length of time A1 plays varies. Oddly, it also varies whether the DAC value is high or low at the end of sample playing, on A0 and A1.
The conjecture is, it's a problem with DMA.
Tested in 4.1.0 and master on a Metro M4 Express.
Code to create wave file:
Code to run on circuitpython:
The text was updated successfully, but these errors were encountered: