Hello,
While inputting a 2-channel (L/R) audio signal via I2S, an issue occurred where the received signals for the left and right channels (Lch and Rch) were swapped due to static electricity.
At that time, the SLVFRMERR flag was set to 1, indicating that a Slave Frame Error had occurred.
What could be the possible causes of Lch and Rch being swapped?
Also, how is the determination of Lch and Rch made?
Is there a way to prevent this issue from occurring?
The main settings are as follows:
MasterSlave = Slave
frameLength = 32
const uint32_t CODEC_BCLK = (/* Pin is configured as FC6_SCK */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Full drive enable */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
const uint32_t CODEC_LRCK = (/* Pin is configured as FC6_TXD_SCL_MISO_WS */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
Best regards
Hi @Gavin_Jia
Thank you for your response.
In our setup, the CPU outputs MCLK to the CODEC, and receives BCLK and LRCK (WS) from the CODEC.
Injecting noise into the MCLK or LRCK (WS) signals does not cause any issues, but when noise is introduced into the BCLK signal, the problem occurs.
Once the left and right channels are swapped, they do not revert on their own, so it seems that restarting the I2S interface is the only solution.
Best regards
Hi @adc_6_6 ,
Thanks for your interest in NXP MIMXRT series!
Static induced channel identification failures may be best approached from an ESD perspective by adding TVS diodes or specialized ESD protection devices for the WS, BCLK, and data lines in close proximity to the I2S interface connectors. Also, consider routing the PCB with I2S and Codec away from sources of noise interference.
If SLVFRMERR is still detected in the software, you can only try to clear the FIFO and reset the I2S.
Best regards,
Gavin
Hi Gavin_Jia
Thank you for your response.
I understand the suggested countermeasure.
However, I would like to understand the underlying mechanism of why this phenomenon occurs.
The settings are as follows:
Classic I2S mode
MODE = 0
POSITION = 0
SCK_POL = 0
WS_POL = 0
I suspect that the system may not determine the left channel based on the falling edge of the WS (Word Select) signal, but rather by using a counter or similar mechanism.
I imagine that a counter is initialized when I2S starts, and thereafter, the channel is determined by checking the counter on each edge.
Therefore, if a falling edge is incorrectly detected (e.g., due to noise or ESD), it might cause a misalignment.
I would just like to clarify the reason behind this behavior, so if you have any information, please let me know.
Best regards