RT685 EVK / Flexcomm I2S 24bit audio

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

RT685 EVK / Flexcomm I2S 24bit audio

2,242 次查看
pitrz
Contributor IV

Hi,

can someone please provide an example how to configure the WM8960 Codec / I2S on RT685 to I2S stereo 24bit mode (which has 32 clocks per sample, so in total 64 per both channels)? 

Technically speaking i can configure / modify the examples to set the right clocks (confirmed via scope)  and the codec to produce data in such format. If i just take the arriving data and copy them from RX to TX i can hear audio correctly, but when i actually inspect the incoming data it does not seem to be in the correct format - i assume i should always get three populated bytes and one zero byte per channel but regardless of how i setup  datalength / framelength i don't get the data i expect. The correct settings i assume here should be datalength = 32, framelength = 64.

Also another interesting issue is that even if i just copy the audio from rx to tx what happens sometimes is that when the code starts executing left and right channels flip. This is completely unpredicatle behavior.

Thanks,

Petr

5 回复数

2,159 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Petr Otoupal ,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you refer to the I2S demos in the SDK, these demos present how to configure I2S module work with the Audio codec chip. So please refer to them for details.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复

2,086 次查看
adrian_klimczak
Contributor II

We have discovered that i2s driver was written in code to work with 16 bits, not with 24 bits. Is this correct? It does not matter what settings we used it did not respect the 24 bit data length and it was always giving us 16 bit data length. Within the i2s driver we had to modify one registry to receive 24 bits numbers, but it has problems, like dma buffer being filled only in half not full, meaning the second half is just zeros.

0 项奖励
回复

2,159 次查看
pitrz
Contributor IV

I have extensively studied all examples in the SDK that have to do with audio, including examples from the HIFI4 part of the SDK. All of them use 48khz audio at 16bit/stereo, which is obvious how to set up from the examples and reference manual. Not a single example has a different audio format / i2s deserializer setup and from the reference manual it is not clear how the data will be coming out of the i2s deserializer wheh the data length is over 16bits.

As i have written, copying received buffers into send buffers works, but the structure of the data in the buffers is not really what one would expect @24bit / 32bit sample size.

0 项奖励
回复

2,159 次查看
pitrz
Contributor IV

I've solved the problem finally. The manual is not clear on what "frame" is and it keeps referring to channel pair. In 16bit mode a Frame is both channels 2x16 = 32bit. In 24bit mode a frame is a single channel with the extra bits unusued.

This works for codec setup in 24bit / I2S standard mode:

I2S_RxGetDefaultConfig(&s_RxConfig);
s_RxConfig.divider = 8;
s_RxConfig.masterSlave = DEMO_I2S_RX_MODE;
s_RxConfig.dataLength = 24;
s_RxConfig.frameLength = 32;
s_RxConfig.pack48 = false;
s_RxConfig.leftJust = false;
s_RxConfig.oneChannel = false;
s_RxConfig.position = 0;

2,100 次查看
adrian_klimczak
Contributor II

Thank you for sharing your solution.

We are also struggling to set up codec for 24bit. By using the example project that works for 16 bit, and by applying your stated settings that worked for you, we still don't get the right results. It might be, that there are more differences than that.

  • I assume, you also use 48 kHz as we do?
  • Sample project uses divider = 16. Could you explain why you used 8?
  • Do we expect to receive 4 bytes per sample, where 3 bytes are used to create 24 bit number, ignoring the fourth byte? Does this mean we have 2 channels: 4 bytes left channel, 4 bytes right channel?

Are there any more changes you have done to the sample project to make it work with 24 bit, please?

0 项奖励
回复