iMxRT SAI in synchronous mode

cancel
Showing results for 
Search instead for 
Did you mean: 

iMxRT SAI in synchronous mode

1,175 Views
francoislion
Contributor I

Hello,

I am evaluating the SAI capabilities of the iMxRT1050, and I have a problem running SAI1 and SAI2 in synchronous Master mode: I want to use the SAI1 Tx Clocks (TX_BCLK and TX_WCLK) as reference clocks for all other data lines SAI1 and SAI2.

To achieve that I configured the 2 SAIs the same way as master except for the SYNC fields of TCR2/RCR2.

Based on the documentation and SDK I configured the SYNC fields as follow:

SAI1.TCR2.SYNC = 0 - Asynchronous mode.

SAI1.RCR2.SYNC = 1 - Sync with Tx

SAI2.TCR2.SYNC = 2 -  Synchronous with another SAI transmitter.

SAI2.RCR2.SYNC = 3  - Synchronous with another SAI transmitter.

In this configuration, the SAI1 is running just fine, but not the SAI2 that does nothing without error report, SAI2 is just not running.

I also tested with SAI2.RCR2.SYNC = 2 because there is something unclear here: The documentation says "3  - Synchronous with another SAI transmitter." for SAI2.RCR2.SYNC, while the SDK use 2:

In fsl_sai.c line 494

        case kSAI_ModeSyncWithOtherTx:
            val = base->RCR2;
            val &= ~I2S_RCR2_SYNC_MASK;
            base->RCR2 = (val | I2S_RCR2_SYNC(2U));
            break;

So how sync between SAIs works? Does someone succeeded using this feature ?

Thanks,

François

0 Kudos
8 Replies

684 Views
dean_jia
NXP Employee
NXP Employee

Hello,

The SAI IP does support the sync mode between different SAI instances, while the i.MX RT SOC platforms do not support that. If the application requires the feature, the control signals (MCLK, BCLK, SYNC) of different SAIs can be connected externally. In this kind of configuration, one SAI works as master, and others work as slaves. I draw a figure to illustrate that, as shown below.

pastedImage_2.png

In this case, SAI1 is the master. SAI2, codec1, and codec2 are slaves.

Regards,

Dean

Best Regards,
Dean

278 Views
frank_dejonge
Contributor I

It's an old issue, but still not fully clear to me. I used the above setup -> SAI1 in master mode, clocks externally connected to SAI2, which is in slave mode. Apparently, it makes no difference if I connect MCLK..is that correct? If I set TX(SAI2) in slave mode and async, RX will be set as async, since it should use the TX bit and frame clocks. Is it set as slave too? (seems not to make a difference since ithe clock pins are not used)

Subsequently, I added SAI3 as a slave device too. All I2S peripherals use DMA through scatter-gather(ping-pong buffer)

While SAI2 seems perfectly sync, SAI3 skips frames regularly. Signals look clean. So I wonder about MCLK...didn't find any clear answers yet...any clues?

0 Kudos

684 Views
giuseppescarpi
Contributor III

Hi Dean,

thank you very much for your answer.

I wonder if this is true for iMX8 Plus.

Thanks

Giuseppe

0 Kudos

684 Views
dean_jia
NXP Employee
NXP Employee

Hi Giuseppe,

Sorry, I'm not familiar with iMX8 Plus. So I have no idea about whether the SOC supports sync mode between different SAI instances. However, I believe it's also feasible to enable sync mode by connecting the control signals together externally, as illustrated above.

Regards,

Dean

Best Regards,
Dean

684 Views
udoeb
Contributor I

Hi Dean,

Thank you very much for clarification. Very helpful.

Regards,

Udo

0 Kudos

684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Thank you Dean for the comments.

best regards,

Mike

0 Kudos

684 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi all,

Sorry for the late reply.

 I am checking SAI2 module synchronous application with IP designer and will post feedback later.

Thank you all for the patience.


Have a great day,
Mike

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

684 Views
udoeb
Contributor I

I do have exactly the same problem. The manual states in section 37.4.3:

The SAI transmitter and receiver can operate synchronously to each other or
synchronously to other SAI peripherals.

In the TCR2 register there is an option available for synchronizing with another SAI:

00b - Asynchronous mode.
01b - Synchronous with receiver.
10b - Synchronous with another SAI transmitter.
11b - Synchronous with another SAI receiver.

 

But I cannot find information on what "another SAI" refers to. How do I define the synch source for a given SAI? Specifically, I want to achieve that SAI2 runs synchronously with SAI1, just as François described above.

I'm using IMXRT1052.

Thanks,

Udo

0 Kudos