Open uutzinger opened 1 month ago
I only tried with AudioBoards that have a regular ESP32 and there, I never had any issue in using I2S and I2C concurrently.
My first gut feeling would be, that you have some pin conflicts. Did you double check the log for the logged GPIO numbers ?
Did you try to reduce the I2C speed ? Not sure if it makes a difference, but use CodecConfig cfg = i2s_stream.defaultConfig(TX_MODE); // or RXTX_MODE
Thanks Phil, I tried 100kHz clock and older version of Espressif Arduino. That did not solve the problem. I ordered Espressif Lyrat to compare. I also ordered shielded wire. I will try shorter wires a little later and I think its time to hookup an oscilloscope.... Thank you for your support.
I looked at the schematics of the Lyrat board from Espressif. It has a low pass filter on the i2c clock and data lines and a comment that its needed to avoid i2c errors. I think that will solve the problem.
If I remember right, the documentation of the module says that the module does not provide any pull up resistors on the I2C pins, so they need to be added externally to make things work.
They're typically 4.7K or 10K ohm, but should be in the range of 2K to 10K. (The internal pullup of the ESP32 of 45k might be insufficient even for 100kHz)
Problem Description
I was trying to set microphone input gain on ES8388. I noticed that I am having I2C communications errors at the end of the setup:
I identified the issue in I2SCodecStream. Its the code after i2s.begin() when you attempt to read the volume and setVolume.
The issue is that it appears when i2s is running you no longer have access to i2c bus:
I thought perhaps there is issue with delay between i2c write/read and I added a delay to the i2c_read and write functions in AudioDriver but that did not resolve the problem.
I can set volume before I start the I2SCodecSteam but the issue is that the begin function of the I2SCodecStream re-initializes the pins, and the board and does not retain the previously applied microphone or headphone volume.
I have not yet tested older ESP32 board versions to see whether this is a "new" bug in the Espressif Arduino libraries.
I would appreciate your guidance on how to go about this: 1) Setting pins and the board is redundant in the I2SCodecStream. Is there an alternative I2S stream setup or shall I try to modify your codec stream code so that if the board is already initialized it does not do it again? I took ino example from AudioDriver. 2) From your previous experience with I2S audio boards, do you think this is Espressif Arduino software issue or do you think its possible that ES8388 needs to have its I2S communication stopped in order to listen to I2C?
Device Description
ESP32-S3 Adafruit feather Custom ES8388 as well as PCB Artist ES8388
Sketch
Other Steps to Reproduce
You move
After i2s_stream.begin
and they cause errors.
i2s_stream.begin(i2s_config); // this should apply I2C and I2S configuration
Does not complete without errors.What is your development environment
Arduino IDE
I have checked existing issues, discussions and online documentation