24 Bit Audio ESP32-WROOM-32 I2S (MCLK)Clock Generation Issues With mclk.multiplier and apll #2192
-
Right now, I have configured the following code, using 24 bits (what I think the issue is), at 44.1kHz. I calculated that LRCLK, BCLK, and MCLK generated should be 44.1kHz, 2.1186MHz, and 11.2896MHz, respectively. Attached are the readings for each clock, and I have come to find that in the I2SESP32V1 header file, if there is a 24 bit resolution, the mclk multiplier is to be automatically set to 384. This is fine, but the boolean apll doubles to clock for some reason, going outside of the range of my PCM1808 ADC. The MCLK I'm seeing is also always analog for whatever reason. I have tried changing the mclk multiplier, but that absolutely destroys the other clocks and the MCLK, making them unmeasurable. I was wondering if anyone had anything you found using the AudioTools Library, and generating MCLK on the ESP32 with a 24 bit resolution. #include "AudioTools.h" #define I2S_BCLK 21 const int SAMPLE_RATE = 44100; //Uses one I2S instance to do both input and output //Basically set up as StreamCopy copier(source, destination) StreamCopy copier(i2sStream, i2sStream); // copies sound into i2s void setup(void) { Serial.begin(115200); // start I2S in Serial.println("I2S started..."); } void loop() { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
As you can read in the IDF documentation for 24 bits the the multiples need to be divisible by 3. I would suggest to try with 32 bits which does not have this restriction. If you get a wrong frequency when using the apll, then I guess this might be a bug in the IDF core. So if it is doubled, did you try to set the the mclk_multiple to 192 ? |
Beta Was this translation helpful? Give feedback.
As you can read in the IDF documentation for 24 bits the the multiples need to be divisible by 3.
I would suggest to try with 32 bits which does not have this restriction.
After all 24 bits is also represented by a int32_t!
If you get a wrong frequency when using the apll, then I guess this might be a bug in the IDF core. So if it is doubled, did you try to set the the mclk_multiple to 192 ?