Using a DAC that requires a MCLK as an additional input #482
-
Hi, I am trying to use this library with NAU8402. On page 12 of the linked datasheet, it describes that the un-mute sequence for the chip requires "Valid MCLK/FS ratio of 256±3 or 512±3 MCLK cycles per FS has been detected", where "FS" is equivalent to "WS" and is also equivalent to the sample rate. In another discussion the maintainer recommended setting "fixed_mclk" and "mclk_io_num" inside i2s_config_t to enable an mclk output. While I can find "fixed_mclk" in the type interface, "mclk_io_num" is not available. Do I need to use the "audio-tools" library for this? Or is it integrated into this library? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
I cannot read. It is i2s_pin_config_t that has "mck_io_num" (it is not "mclk_io_num" btw, which is as described in the other comment, i thought it was a typo) |
Beta Was this translation helpful? Give feedback.
-
I did flash the firmware with mck_io_num set to 23 and fixed_mclk set to true, but there is still no audio output from the DAC. How can I ensure that I have set the MCLK/FS ratio to 256 or 512? |
Beta Was this translation helpful? Give feedback.
-
But this has nothing to do with my library! Wouldn't you read the ESP32 documentation first? https://docs.espressif.com/projects/esp-idf/en/v4.2.2/esp32/api-reference/peripherals/i2s.html That's complete nonsense: you can't use pin 23 for this and setting fixed_mclk to true does not make any sense either! You need to provide the frequency to fixed_mclk and if I remember right only GPIO00, GPIO01 and GPIO02 can be used as master clock pins. But you better double check with the documentation. ps. If you activated the logging you should have seen the error message that 23 is not supported! |
Beta Was this translation helpful? Give feedback.
-
I have found out that I need to use ESP-IDF 5.1.1, because it contains "I2S_MULTIPLE_MCLK_256" for exactly this purpose. However, I do not think ESP-IDF 5.1.1 is used by arduino or platformio, so I'm following the instructions here: https://github.com/pschatzmann/ESP32-A2DP/wiki/Espressif-IDF-as-a-Component For some reason, the "idf.py create_project esp32-adp" command doesn't work, but that's not this library's problem... I got around this by creating a new project using the VSCode ESP-IDF extension, and continued with the rest of your guide. Everything works up until "idf.py build".... The compiler doesn't like that your library wants to do
Along with a few other similar errors (PIN_CTRL especially)... I tried both the most recent release (1.7.4) and the master branch. Both hit these same errors... |
Beta Was this translation helpful? Give feedback.
-
But your assumption is completely wrong! In any case you are limited to the supported pins mentioned above! If you want to use 5.1.1 I suggest that you deactivate the I2S output in this project and use the I2S output of the AudioTools which should support both the old and new I2S APIs. ps. I committed a correction to exclude the i2s_mclk_pin_select() method starting from 5.1.1 |
Beta Was this translation helpful? Give feedback.
But this has nothing to do with my library!
Wouldn't you read the ESP32 documentation first? https://docs.espressif.com/projects/esp-idf/en/v4.2.2/esp32/api-reference/peripherals/i2s.html
That's complete nonsense: you can't use pin 23 for this and setting fixed_mclk to true does not make any sense either!
You need to provide the frequency to fixed_mclk and if I remember right only GPIO00, GPIO01 and GPIO02 can be used as master clock pins. But you better double check with the documentation.
ps. If you activated the logging you should have seen the error message that 23 is not supported!