I2S Slave with SGPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2S Slave with SGPIO

669 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by GH on Fri Nov 28 02:09:00 MST 2014
Hi,

im working on the implementation of a I2S slave on the SGPIO peripheral of a LPC4337.
All in all it works, but from time to time I experience some synchronization problems.

All clocks are provided by external peripherals. I'm running all Slices with the external word clock (SCK).
Further I need to synchronize the Position Counters of the Slices with the word clock. Therefore I continuously read the REG value of the Slice connected to the WCLK pin and enable the other slices (connected to the data lines) when I read the expected pattern.

Sometimes the synchronization fails and position counters are activated to late, thus the data lines are misaligned to the WCLK by one bit. It seems like the timing is in someway unpredicted, when starting the slices using the CTRL_ENABLED register.
Usually I would expect the LPC4337 to be fast enough to perform this tasks, since it's running at 196MHz while the I2S bus is running at 3MHz (bit clock) with a 48kHz word clock.

See the code of the synchronization loop:

while(LPC_SGPIO->REG[SGPIO_SLICE_N]!=SGPIO_PATTERN_MATCH_VALUE)
{
count++;
if(count>=MAX_SYNC_COUNT){return -1;}
}

LPC_SGPIO->CTRL_ENABLED |= (1<<SGPIO_SLICE_L);


Is this the right design pattern to implement such a synchronization to a external signal? Or are there other ways to implement such a task?

Thanks in advance for any help.

GH
Labels (1)
0 Kudos
2 Replies

617 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Mon Dec 08 17:27:18 MST 2014
Hi, GH,

You will want to set the CTRL_ENABLED before changing the count register.
Thanks!
0 Kudos

617 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by GH on Fri Nov 28 05:41:13 MST 2014
For some reason the complete message doesn't appear in the forum.
So here follows the rest:

while(LPC_SGPIO->REG[SGPIO_SLICE_N]!=SGPIO_PATTERN_MATCH_VALUE)
{
count++;
if(count>=MAX_SYNC_COUNT){return -1;}
}

LPC_SGPIO->CTRL_ENABLED |= (SGPIO_SLICE_L);


Is this the right design pattern to implement such a synchronization to a external signal? Or are there other ways to implement such a task?

Thanks in advance for any help.

GH
0 Kudos