I2s In/out slave with SGPIO

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

I2s In/out slave with SGPIO

跳至解决方案
2,569 次查看
cybaluke
Contributor III

Hi,

on a LPC4323 I have to implement two I2S ports (2 stereo input pairs) input and two I2S ports (2 stereo output pairs).

All I2S are slave ports, I mean they share the same BCLK (bit clock) and LRCK (left/right word sync) generated from an external master. I would use SGPIO pins.

Any suggestions for me? Can you suggest an example to start? Is it possible synchronize the SGPIO I2S ports with the I2S ports already available on LPC4323 and using both native I2S ports and emulated I2s via SGPIO?

thanks

标签 (1)
0 项奖励
回复
1 解答
2,113 次查看
rolfmeeser
NXP Employee
NXP Employee

There is no resource in SGPIO that would allow to synchronize to an I2S master. However, it is easily possible with the assistance of the SCT.

The idea is for SCT to monitor the internal state of the I2S slices, and gate the bit clock while SGPIO slices and the external I2S master are out of sync. The I2S bit clock goes to SGPIO, the I2S word select goes to SCT, and an external connection is required from an SCT output to an SGPIO pin to provide the clock qualifier function.

An SGPIO slice (slice J, SGPIO3) is configured to provide its own idea of the WS signal. It is connected to CTIN_0 of the SCT via the GIMA. A falling edge of the signal causes SCT to gate the SGPIO bit clock ("CLOCK_GATE"=0). SGPIO slices are now freezed in a known state. SCT monitors the master's WS signal, and reenables the bit clock ("CLOCK_GATE"=1) when it sees a falling edge there. Master and slave are now in sync, and the screenshot shows that no further clock gating occurs in the following frames. Synchronization only took one frame time.

wssync.png

The attached initialization file is not a complete project, but I hope you can get the idea from it. Data transfer is done in the SGPIO interrupt, and includes extracting the 24-bit samples (also the bit flipping due to SGPIO sending LSB first only).

Only two events are used in SCT, but two pins have to be used for connecting SCT to SGPIO.

在原帖中查看解决方案

4 回复数
2,113 次查看
soledad
NXP Employee
NXP Employee

Hello Luke,

I suggest you to check the below application notes:

http://www.nxp.com/documents/application_note/AN11275.zip?fasp=1&WT_TYPE=Application%20Notes&WT_VEND... 

http://www.nxp.com/documents/application_note/AN11196.zip?fasp=1&WT_TYPE=Application%20Notes&WT_VEND... 

http://www.nxp.com/documents/application_note/AN11343.zip?fasp=1&WT_TYPE=Application%20Notes&WT_VEND... 

http://www.nxp.com/documents/application_note/AN11351.zip?fasp=1&WT_TYPE=Application%20Notes&WT_VEND... 

In addition, there is a software example using 4 SGPIO pins for a four channel I2S TX. Look in the folder \lpc43xx\Examples\SGPIO in this software package:

https://www.lpcware.com/content/nxpfile/lpc4350apdlzip


Have a great day,
Sol

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

0 项奖励
回复
2,113 次查看
cybaluke
Contributor III

Hi, thanks for your suggestions...

in my project one I2S port is the master and the other three are slaves, so I had some problems to define SGPIO slices to sync I2S 24bit data from the ADC/DAC of the slave ports with the I2S LRCK(WS) and BCLK(BCK) signals from the master one.

0 项奖励
回复
2,114 次查看
rolfmeeser
NXP Employee
NXP Employee

There is no resource in SGPIO that would allow to synchronize to an I2S master. However, it is easily possible with the assistance of the SCT.

The idea is for SCT to monitor the internal state of the I2S slices, and gate the bit clock while SGPIO slices and the external I2S master are out of sync. The I2S bit clock goes to SGPIO, the I2S word select goes to SCT, and an external connection is required from an SCT output to an SGPIO pin to provide the clock qualifier function.

An SGPIO slice (slice J, SGPIO3) is configured to provide its own idea of the WS signal. It is connected to CTIN_0 of the SCT via the GIMA. A falling edge of the signal causes SCT to gate the SGPIO bit clock ("CLOCK_GATE"=0). SGPIO slices are now freezed in a known state. SCT monitors the master's WS signal, and reenables the bit clock ("CLOCK_GATE"=1) when it sees a falling edge there. Master and slave are now in sync, and the screenshot shows that no further clock gating occurs in the following frames. Synchronization only took one frame time.

wssync.png

The attached initialization file is not a complete project, but I hope you can get the idea from it. Data transfer is done in the SGPIO interrupt, and includes extracting the 24-bit samples (also the bit flipping due to SGPIO sending LSB first only).

Only two events are used in SCT, but two pins have to be used for connecting SCT to SGPIO.

2,113 次查看
cybaluke
Contributor III

Hi Rolf, thanks for your helpful answer, I'll start from your code to solve my issue.

0 项奖励
回复