SAI lock up after receive

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

SAI lock up after receive

跳至解决方案
1,705 次查看
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,

标签 (1)
1 解答
1,465 次查看
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 项奖励
回复
2 回复数
1,466 次查看
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 项奖励
回复
1,465 次查看
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 项奖励
回复