-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2S/TDM SLAVE not sync on WS (IDFGH-8003) #9513
Comments
Thank you so much for providing such a detailed investigation! And sorry for the asynchronization in the slave duplex TDM mode. According to your discription, I suspect that the issue could be caused by the different clock domains of TX and RX channels, because unlike the former chips, the I2S on ESP32-C3 and ESP32-S3 has separate clock domain for the TX and RX channels, which can support TX and RX working at different clock but can also lead to the asynchronization. In master duplex mode, we select the 160m PLL clock for TX channel and share the clock to RX channel by setting the bit But in slave duplex mode, both TX and RX channel will not generate the clocks, I don't know if the If you want to try by yourself, here are two suggestions might work:
And as for the clock source, ESP32-C3 and ESP32-S3 do not support APLL, it's a mistake while generating the |
Further investigation shows that the asynchronization is related to the high sample rate. When the sample rate is high(like 96KHz), we must guarantee the internal mclk frequency of slave should be more than 8 times to the bclk. But currently it is fixed to 8 in the driver, will make it changeable in the next bugfix. FYI, 48KHz sample rate has no such issue. You can lower down the sample rate if 96KHz is not necessary. |
Environment
Problem Description
If I2S/TDM is configured as Slave in full-duplex data played out is not correctly aligned on WS.
Sometimes first channel appear when WS is High, some times when WS is LOW.
Expected Behavior
I2S/TDM slave should recognize channel order and should output data accordingly WS Polarity.
Actual Behavior
Both ESP send the same pattern that identify channels.
Frame 1
Frame 2
ES:
0x1AAAAA01
0x1BBBBB01
0x1CCCCC01
0x1DDDDD01
0x2AAAAA00
0x2BBBBB00
0x2CCCCC00
0x2DDDDD00
Master and Slave esp are both configured in the same standard I2S_TDM_PHILIP.
This happen only rebooting the slave.
No overflow are in evidence ( we monitor and print it )
We also monitor interrupt from DMA sent and DMA rec.
These interrupt seem to be not synchronized and the distance between these interrupt differ from different power cycle.
We notice that when this distance is less then X is when the system work properly.
We wait for updated esp32-s3_technical_reference_manual_en for a while.
Now finally v0.8 is released and we have full documentation for I2S.
On page 742 you mention that peripheral can work
simultaneously
andindependently
but seem that there is no way to start tx and rx exactly at the same time that could be the root cause of the problem.Tried also to start peripheral manually to reduce this latency but no way.
Also resetting hw fifo, restarting gdma channel. No way.
It seem that Slave a full duplex slave mode is not supported.
We have also a lot of doubt about I2S clocking.
In esp32s3 and esp32c3 you provide a MCLK in but common and standard audio clock like 24.576 MHz are not supported because I2S_RX/TX_CLOK in slave mode must be 8 >= bit clock and this kind of master clock never exist in audio application.
I also would like to put in evidence that driver only support 160 MHz clock and that
i2s_struct.h
mention APLL that is not supported.uint32_t rx_clk_sel : 2; /*Select I2S Rx module source clock. 0: no clock. 1: APLL. 2: CLK160. 3: I2S_MCLK_in.*/
We Also tried to use
PLL_D2_CLOCK
( 240 MHz ) as source with this clock division coeff :and a
MI/MO
equal to 10 for bit clock division but without good result.What we are doing wrong ?
How to allow this peripheral to work properly in a low latency ( 1 ms ) full-duplex i2s slave application ?
Thank you in advance.
Steps to reproduce
Code to reproduce this issue
tdm_test_idf5.zip
The text was updated successfully, but these errors were encountered: