SAI lock up after receive

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

SAI lock up after receive

Jump to solution
901 Views
javiercardona
Contributor III

Hi,

On our KL27 device we have observed that SAI receive transfers will put the SAI peripheral in a certain state that it will not be able to transmit anymore.

We have to functions, play() and record() which make repeated calls to SAI_TransferSendDMA() and SAI_TransferReceiveDMA() respectively.

We are able to call play() repeatedly, and the audio is transferred to the codec.

We are able to call record() repeatedly, and the audio is received from the codec.

We are able to call record() after play(), but a play() following a record will not work.  No DMA callbacks are invoked, and the FIFO Error Flag (I2S0_TCSR:FEF) is set before initiating the transmission and cannot be cleared.

In our configuration TX is in Async mode, and RX is in Sync mode, which is the default configuration for that driver.

We have seen other similar discussions on the forums regarding SAI problems.  One of them recommended clearing the FIFO error flag before every enable operation, but that did not solve the issue.

Any suggestions on how to resolve this issue would be gladly appreciated.

Best,

Labels (1)
1 Solution
661 Views
2bluesc
Contributor II

I've had the exact same problem.  You need to service both FIFOs in synchronous mode, it sounds like your record is operating synchronously but only reading the RX FIFO while using TX asynchronously.  When you run the record the TX FIFO is put in an error state that you don't seem to be resetting.  That's why the order matters.

It's not obvious and not mentioned in the reference manual but makes sense once you think about it.

Two ways to solve it for anyone else who stumbles on I2S or SAI hanging:

  1. Mask the other peripheral words if you aren't going to be reading/writing to it (DMA or direct I think) use the I2S_TMR and I2S_RMR registers.
  2. Disable the unused FIFO using the RCE and TCE bits.

View solution in original post

0 Kudos
2 Replies
662 Views
2bluesc
Contributor II

I've had the exact same problem.  You need to service both FIFOs in synchronous mode, it sounds like your record is operating synchronously but only reading the RX FIFO while using TX asynchronously.  When you run the record the TX FIFO is put in an error state that you don't seem to be resetting.  That's why the order matters.

It's not obvious and not mentioned in the reference manual but makes sense once you think about it.

Two ways to solve it for anyone else who stumbles on I2S or SAI hanging:

  1. Mask the other peripheral words if you aren't going to be reading/writing to it (DMA or direct I think) use the I2S_TMR and I2S_RMR registers.
  2. Disable the unused FIFO using the RCE and TCE bits.
0 Kudos
661 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Javier,

Could you paste your project here so that we can have a review for the code?

BR

Xiangjun Rong

0 Kudos