streams_generator_i2s_ESP32 generates incorrect bit rate but MCLK is correct. How? #1453
-
Would like to use ESP32 Dev Module as BT sink, which did not work, leading to this trial, which showed the problem. Setup of test sinewave stream is:
Set Audiologger to Warning:
I added MCK signal in AudioConfig.h line 229: I get 12.29MHz as MCK, but BCK and WCK is incorrect at 2.458MHz and 51.20 kHz respectively. Expected is 2.304MHz and 48 kHz. This does work with PCM5102, generating a tone, BUT Texas Instruments CC8531 RF SoC refuses to accept this as valid input, because the sample rate is wrong. See attached scope screenshot with measured clock rates. How do I fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I don't understand what you try to do and what your issue is: BlueTooth Sink and Sine Generator and a sample rate of 48000. This does not make any sense to me! If you think that the frequency is wrong, then I think this would rather be a question for Espressif: The only thing that I can contribute is that you I2S lets you define a fixed_mclk: see https://docs.espressif.com/projects/esp-idf/en/v4.2.2/esp32/api-reference/peripherals/i2s.html In addition your code is wrong: you generate a 16 bit signal and pretend that it is 24 bits. This does not generate any meaningful output: use 16 bits with int16_t and 24 bits with int24_t:
|
Beta Was this translation helpful? Give feedback.
-
No worries: I got confused first, because initially I thought you wanted to use my A2DP library to implement the A2DP sink. This uses the IDF API that only supports 44100. I needed to read the text a second time to finally understand what your issue is: sometimes less is more! |
Beta Was this translation helpful? Give feedback.
-
I would suggest to use the AudioTools to convert the 16 bits to 24. But to be honest, I don't see any advantage of going over 16... |
Beta Was this translation helpful? Give feedback.
I don't understand what you try to do and what your issue is: BlueTooth Sink and Sine Generator and a sample rate of 48000. This does not make any sense to me!
If you think that the frequency is wrong, then I think this would rather be a question for Espressif: The only thing that I can contribute is that you I2S lets you define a fixed_mclk: see https://docs.espressif.com/projects/esp-idf/en/v4.2.2/esp32/api-reference/peripherals/i2s.html
In addition your code is wrong: you generate a 16 bit signal and pretend that it is 24 bits. This does not generate any meaningful output: use 16 bits with int16_t and 24 bits with int24_t: