0

What's fastest practical sample_rate for M4 DACs?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

What's fastest practical sample_rate for M4 DACs?

by kevinjwalters on Fri Jul 05, 2019 7:39 pm

I'm trying to play back a looping sample at high sample rates on both M4 DACs (PyGamer running 4.1.0-beta.1 with #1922 fix) and I think it's topping out at approximately 200k. Looking at the output I see an obvious jump in output frequency from 100k to 200k sample_rate but after that not much changes. It'll take values up to a million without complaining.

Code: Select all | TOGGLE FULL SIZE
import audioio
import board
dacs = audioio.AudioOut(board.A0, right_channel=board.A1)

output_wave = audioio.RawSample(rawdata, channel_count=2, sample_rate = 100000)
dacs.play(output_wave, loop=True)
output_wave.sample_rate = 200000
dacs.play(output_wave, loop=True)
output_wave.sample_rate = 300000
dacs.play(output_wave, loop=True)
output_wave.sample_rate = 400000
dacs.play(output_wave, loop=True)
output_wave.sample_rate = 1000000
dacs.play(output_wave, loop=True)

kevinjwalters
 
Posts: 1024
Joined: Sun Oct 01, 2017 3:15 pm

Re: What's fastest practical sample_rate for M4 DACs?

by tannewt on Sun Jul 07, 2019 9:42 pm

Looks like you know better than I do. :-) I'd suggesting looking into the clock limits of the DAC. I believe we only supply it 48mhz now but may be able to bump it up.

tannewt
 
Posts: 2988
Joined: Thu Oct 06, 2016 8:48 pm

Re: What's fastest practical sample_rate for M4 DACs?

by kevinjwalters on Mon Jul 08, 2019 7:01 am

I'm not sure as this is my first foray into the dark world of clocks but I think it's running from a 48MHz source (peripheral_clk_config.h#L330) divided by 24 (hpl_gclk_config.h#L466) to give 2MHz for DAC. With 12 clock cycles per conversion (ignoring for the moment the extra settle 12 time) then that could be what's capping output rate to 166.667kHz?

Is there a 12MHz clock available to get this up to max 1Msps output rate? It looks like CONF_DAC0_CCTRL and CONF_DAC1_CCTRL need to go to 2 for this setting.

Could CONF_DAC0_CCTRL and CONF_DAC1_CCTRL with value of 1 be the cause of the voltage limitation discussed in PyGamer DACs limited to 2.5V - 2.6V ?? If it's refusing to supply more than 2.5V/200ohm = 12.5mA at value 1 that could explain this max value?

kevinjwalters
 
Posts: 1024
Joined: Sun Oct 01, 2017 3:15 pm

Re: What's fastest practical sample_rate for M4 DACs?

by tannewt on Mon Jul 08, 2019 12:49 pm

I'd have to look into it. I'd recommend you experiment with it. You know better than I do at this point.

tannewt
 
Posts: 2988
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.