IMXRT1171 - SAI Clock configurations.

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

IMXRT1171 - SAI Clock configurations.

Jump to solution
599 Views
BrK_
Contributor III

Hello,

I want to use the Read and Write functions with SAI1 in slave mode and the Write function with SAI2 in master mode using DMA on the imxrt1171. For this, I have made the following configurations:

BrK__0-1725274347204.pngBrK__1-1725274362281.png

  • The only difference in the master and slave settings is that when the slave is selected, bclkrcswap is set to true.
  • I set the Read function to synchronous mode and the Write function to asynchronous mode.
  • I initialized the Tx DATA, Rx DATA, Tx BCLK, and Tx SYNC pins for both SAI1 and SAI2.
  • I retrieved each peripheral's own clock frequency using the CLOCK_GetRootClockFreq function and used it to fill the sourceClockHz parameter in the SAI_TxSetBitClockRate and SAI_RxSetBitClockRate functions. I also input the sample rate, bit width, and channel number values.

Here are a few problems I'm facing:

BrK__3-1725274553897.png

  1. When I try to send data using SAI2, which is set as the master, I am successful, but I cannot obtain consistent values when changing the sample rate. When I set the sample rate to 48kHz using the SAI_TxSetBitClockRate or SAI_RxSetBitClockRate function, I do not see the sync frequency at 48kHz. I can achieve this value by adjusting the clock root configurations, but this approach is not sustainable. How can I obtain the desired sample rate when I want to set it to 44.1kHz, 16kHz, or 48kHz? Is there something I am missing in the configurations?
  2. I am unable to perform the receive function with SAI1 set as the slave. I have verified the clock, sync, and data signals at a 16kHz sample rate using a logic analyzer. However, the SAI EDMA callback is not triggered, and I am unable to receive the data. Is there a different setting I should use for the slave, or is there something I might be overlooking?
0 Kudos
Reply
1 Solution
549 Views
mayliu1
NXP Employee
NXP Employee

Hi @BrK_,

     Thank you for your interest in the NXP MIMXRT product, I would  like to provide service for you.

1: If you want to set SAI1 to slave mode, s_saiConfig.masterSlave should set as kSAI_Slave. 

  1. The external master should send the bclk and frame sync clock correctly
  2. The audio format of the master and slave should be strictly consistent.
  3. Double check configuration of s_saiConfig.syncMode setting. 

 

mayliu1_0-1725363473251.png

 

1:  You can refer to the SDK demo examples “evkbmimxrt1170_sai_edma_ping_pong_buffer_cm7”and modify the corresponding configuration to verify SAI2

mayliu1_1-1725363615991.png

 

bitClockFreq = sampleRate * bitWidth * channelNumbers

You can use an tool to test whether the clock is correct.   

Best Regards

mayliu

 

View solution in original post

0 Kudos
Reply
1 Reply
550 Views
mayliu1
NXP Employee
NXP Employee

Hi @BrK_,

     Thank you for your interest in the NXP MIMXRT product, I would  like to provide service for you.

1: If you want to set SAI1 to slave mode, s_saiConfig.masterSlave should set as kSAI_Slave. 

  1. The external master should send the bclk and frame sync clock correctly
  2. The audio format of the master and slave should be strictly consistent.
  3. Double check configuration of s_saiConfig.syncMode setting. 

 

mayliu1_0-1725363473251.png

 

1:  You can refer to the SDK demo examples “evkbmimxrt1170_sai_edma_ping_pong_buffer_cm7”and modify the corresponding configuration to verify SAI2

mayliu1_1-1725363615991.png

 

bitClockFreq = sampleRate * bitWidth * channelNumbers

You can use an tool to test whether the clock is correct.   

Best Regards

mayliu

 

0 Kudos
Reply