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
解決済! 解決策の投稿を見る。
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.
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.
Hello Luke,
I suggest you to check the below application notes:
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!
-----------------------------------------------------------------------------------------------------------------------
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.
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.
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.
Hi Rolf, thanks for your helpful answer, I'll start from your code to solve my issue.