Using 24-bit I2S data format

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using 24-bit I2S data format

3,228件の閲覧回数
scottm
Senior Contributor II

I'm attempting to use the MCUX SDK i2s_dma_driver to send 24-bit frames on an LPC55S69 and I'm running into trouble. The code I'm working on is being ported from the MK22FN1M0 but doesn't use the SDK. The LPC55S69 user's manual is less clear than the Kinetis manual when it comes to describing I2S data formats. The SDK manual has virtually no explanation.

To match the Kinetis version, what I'm attempting to do is to send a buffer of single-channel, 24-bit frames. The source data is stored in a buffer of 32-bit integers, left justified. I can't find any combination of settings that gives me the results I expect, and I'm concerned about the fact that the TX function takes the number of bytes and not frames or words. It's not clear what it's counting.

I'm testing with a repeating value of 0xffffff00 and the expected result is the data line staying high for the whole transmission. The leftJust setting seems to have no effect on the results.

Any idea how this should be set up?

Thanks,

Scott

0 件の賞賛
返信
7 返答(返信)

997件の閲覧回数
sfenwick76
Contributor I
Any luck with this? I'm in the same boat -- need to do 24-bit transfers but LEFTJUST doesn't seem to be doing anything.
0 件の賞賛
返信

992件の閲覧回数
vishal_roy
Contributor II

The DMA on this LPC part does not support 24bit transfers. So you will have to manually zero pad your frames to either support 16/32 bit and configure your codec accordingly. This solved it for us.

0 件の賞賛
返信

2,180件の閲覧回数
vishal_roy
Contributor II

Any Updates here? Working on s similar issue with FreeRTOS USB speker demo wanted Audio stream to work with 24bit 48khz. Was able to to get 32 bit and 16bit working fine.

 

vishal_roy_0-1722224939284.png

Will above be the root cause?

0 件の賞賛
返信

3,216件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport
Hi, As you know there is LEFTJUST bit is located at bit 9 of CFG1, I copy it here: LEFTJUST Left justify data. 0 0 Data is transferred between the FIFO and the I2S serializer/deserializer right justified, i.e. starting from bit 0 and continuing to the position defined by DATALEN. It would correspond to right justified data in the stream on the data bus. 1 Data is transferred between the FIFO and the I2S serializer/deserializer left justified, i.e. starting from the MSB of the FIFO entry and continuing for the number of bits defined by DATALEN. It would correspond to left justified data in the stream on the data bus. But the LEFTJUST bit just takes effect on the condition that the Data length is NOT equal to the Frame Length. Let's consider the normal I2S case that there are two slots, each slot consists of 32 bit clocks, in other words, there are 64 bits clocks in one I2S cycle, and the data length is 24 bits in each slot, in the case, assume the LEFTJUST is cleared, and the data in FIFOWR is 0xFFFFFF00, the 24 bits valid data will be 0xFFFF00. Assume the LEFTJUST is set, and the data in FIFOWR is 0xFFFFFF00, the valid data will be 0xFFFFFF. If the frame length is equal to the data length for example all of them are 32 bits, in the case all 32 bits data in FIFOWR are valid, and will output to data pin, the LEFTJUST bit is useless. Hope it can help you BR XiangJun Rong
0 件の賞賛
返信

3,214件の閲覧回数
scottm
Senior Contributor II

Hi,

What would really help me is if you could give this in terms of the SDK driver. The driver doesn't expose FIFOWR and the I2S DMA driver in particular is lacking any description of how it actually passes data to the I2S module.

My input buffer is composed of 32-bit values of which only the high 24 bits are significant. I need to send just those 24 bits per word. What settings do I use for the SDK driver to accomplish that?

It's not urgent now because I've worked around it by modifying my data to be right-justified but I'd still like to understand what's going on.

Thanks,

Scott

0 件の賞賛
返信

3,206件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Scott,

You can configure the LEFTJUST bit with the driver for tramsmitter:

static i2s_config_t s_TxConfig;
static i2s_config_t s_RxConfig;

I2S_TxGetDefaultConfig(&s_TxConfig);
s_TxConfig.divider = DEMO_I2S_CLOCK_DIVIDER;
s_TxConfig.masterSlave = DEMO_I2S_TX_MODE;
s_TxConfig.leftJust=true;

I2S_TxInit(DEMO_I2S_TX, &s_TxConfig);

You can configure the LEFTJUST bit with the driver for receiver:

I2S_RxGetDefaultConfig(&s_RxConfig);
s_RxConfig.divider = DEMO_I2S_CLOCK_DIVIDER;
s_RxConfig.masterSlave = DEMO_I2S_RX_MODE;

s_RxConfig.leftJust=true; //true:left justified data, false:right justfied data

I2S_RxInit(DEMO_I2S_RX, &s_RxConfig);

 

Hope it can help you

BR

XiangJun Rong

0 件の賞賛
返信

3,190件の閲覧回数
scottm
Senior Contributor II

The LEFTJUST setting didn't seem to be doing anything. All of my data comes from a lookup table anyway, so I just rebuilt the table with right-justified data.

I guess just consider this a documentation request, to clarify the data format options with a diagram like the Kinetis equivalent has.

Thanks,

Scott

0 件の賞賛
返信