Adafruit_ZeroI2S icon indicating copy to clipboard operation
Adafruit_ZeroI2S copied to clipboard

48kHz output mismatch

Open 23justJohn19 opened this issue 2 years ago • 0 comments

  • Arduino board: Sparkfun ATSAMD21G R3 Breakout Board

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.18.19

  • List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too): LIST REPRO STEPS BELOW

Hi!

I2S audio amplifier connected to the standard pins (D0 frame clock, D1 bit clock, D9 data). Works well and is stable with all the Adafruit Github demos included in the library, thanks so much for sharing this code.

My specific issue is in the DMA demo from here:

https://github.com/adafruit/Adafruit_ZeroI2S/blob/master/examples/dma/dma.ino

This demo code works perfectly and I've verified the frame sync frequency on my 'scope is correct:

  /* begin I2S on the default pins. 24 bit depth at
   * 44100 samples per second
   */
  i2s.begin(I2S_32_BIT, 44100);
  i2s.enableTx();

  stat = myDMA.startJob();

However, changing the sample rate to this instead

  /* begin I2S on the default pins. 24 bit depth at
   * 44100 samples per second
   */
  i2s.begin(I2S_32_BIT, 48000);
  i2s.enableTx();

  stat = myDMA.startJob();

... results in clock frequency of 50.00 Khz

Being curious, I set the frequency to 8000 and measured 8.07 Khz, which tracks since I'm using the internal oscillator, not a crystal.

Other testing:

8000 Hz request --> 8.07 kHz output 46kHz request --> 46.89 kHz output 48kHz request --> 50.00 kHz output

Maybe I've made a silly error somewhere? I'm running the demo code otherwise unmodified.

23justJohn19 avatar Oct 27 '22 16:10 23justJohn19