Closed carlocaione closed 7 months ago
A possible workaround to this problem is to set:
s_RxConfig.dataLength = 32;
s_RxConfig.frameLength = 32;
so that we are only going to read from FIFORD
but that means that I have to discard the 4-th byte in each slot in the output buffer.
0x01 | 0x00 | 0x00 | 0x?? | 0x02 | 0x00 | 0x00 | 0x?? | ...
The configuration of I2S
in my use case is wrong (see https://github.com/nxp-mcuxpresso/mcux-sdk/issues/190#issuecomment-2055928881). Given that I'm not sure if the problem still stands. Closing this down.
Using the
EVK MIMXRT685
asI2S
slave configured as:That is translated in the following configuaration:
When using this configuration in interrupt mode we get a wrong and doubled data coming from channels in the buffer.
So for example if we have
0x01
in the fist channel,0x02
in the second channel and so on (until0x10
in the 16th channel), the data we get in the RX buffer is:when we would expect:
This is due to how
I2S_TxHandleIRQ()
is managing incoming data, and in particular the problem is here: https://github.com/nxp-mcuxpresso/mcux-sdk/blob/8f80c64d0b7dadea121cf7a42593c49cf45c1999/drivers/flexcomm/i2s/fsl_i2s.c#L1125-L1140These are the problematic steps:
0x01 | 0x00 | 0x00
) fromFIFORD
popping the FIFO.0x02 | 0x00 | 0x00
) fromFIFORD48H
but this is not popping the FIFO (while it should according to the documentation, it is basically behaving likeFIFORD48HNOPOP
).So the problem is that with this configuration
FIFORD48H
is not popping from the FIFO and it is behaving likeFIFORD48HNOPOP
causing duplicating data in the output buffer.To be pedantic the
I2S_RxHandleIRQ()
is not even entirely correct because it is neglecting theONECHANNEL
setting, according to the documentation (section25.7.4
ofUM11147
):So when
ONECHANNEL
is set we should be reading only fromFIFORD
and not even fromFIFORD48H
.