Skip to main content
digigram
Associate
June 3, 2016
Question

SAI Clock Generator in Slave mode

Posted on June 03, 2016 at 11:17

Hello,

In order to use both SAI_A and SAI_B, both in slave mode, on a STM32L4, I am wondering if the SAI_CK clock is used ? 

An external device is supposed to provide the BCLK and the FS clock (in my case), and the reference manual says that ''When the audio block is defined as slave, the clock generator is OFF.'' (p.1328). This makes me think that I don't need to generate any further clock for the SAI. But under CubeMX, I can change SAI1 and SAI2's clocks. I can even use an external SAIx clock with an input. 

So do I need to provide any clock for the two SAI (which are both in slave mode) with the BCLK and the FS clock ? If not, why CubeMX gives me the possibility to change SAI1 and SAI2 clock ?

Thanks,

Florian
This topic has been closed for replies.

9 replies

Walid FTITI_O
Visitor II
June 3, 2016
Posted on June 03, 2016 at 12:22

Hi ch..florian,

I report this internally to our CubeMx team for check.

-Hannibal-

digigram
digigramAuthor
Associate
June 7, 2016
Posted on June 07, 2016 at 09:09

Hello Hannibal,

Thank you for reporting this. Do you have any news about my questions ?

Florian

Jeanne Joly
Associate
January 11, 2018
Posted on January 11, 2018 at 11:41

Hello ch..florian,

If you still have some doubts on how SAI works on STM32L4, I invite you to have a look to the following doc (

http://www.st.com/content/ccc/resource/training/technical/product_training/0c/16/3b/b4/76/8a/47/51/STM32L4_Peripheral_SAI.pdf/files/STM32L4_Peripheral_SAI.pdf/jcr:content/translations/en.STM32L4_Peripheral_SAI.pdf

).

In few words, The SAI is composed of two independent sub-blocks (A and B). Each sub-block can be configured in receive or transmit, master or slave, with its own protocol.

If the SAI synchronization is not used, each sub-block is independent. Some examples : 

  • SAI_A in I2S Philips Master, SAI-B in SPDIF.
  • SAI_A in TDM slave, SAI_B in AC97.

In slave mode, the SAI is receiving the timing signals from an external device : 

  • the bit clock (SCK), the frame synchonization (FS).
  • the serial data line (SD) can be input or output.

And in salve mode, the MCLK (master clock) is not used.

Sorry for the late answer...

BR

Jeanne

waclawek.jan
Super User
January 18, 2018
Posted on January 18, 2018 at 21:29

But this does not answer the original queson: why does CubeMX allow to set and change SAI clocks when they are not used in slave mode?

JW

Jeanne Joly
Associate
January 19, 2018
Posted on January 19, 2018 at 10:01

hi

Waclawek.Jan

,

For your information, I am using CUbeMX4.23 (the latest).

When SAI1_A and SAI1_B are in slave mode, you can't change, in SAI1 configuration, the audio frequency.

Here is an example where SAI1_A is in master mode and SAI1_B in slave : (SAI1_A audio clock can be changed, not the SAI1_B) :

0690X00000609QgQAI.png

I assume that you already seen that.

I guess that your point is more regarding the clock configuration view.

If you configure SAI1_A and SAI1_B in slave mode and RCC as SAI1 Extern Clock (that is close to your use case), you can do as follow :

0690X00000609M7QAI.png

fill the SAI1 extern clock and it will calculate automatically the SAI1 clk.

Moreover, you can change the SAI1 clk itself and it will change the PLLSRC that is normal.

See the scheme below that is taken from the doc I advised you in my last post :

0690X00000609QqQAI.png

I hope it is clearer.

If not, please be more precise (send an ioc, a picture of the symptom you see) in order to help you.

BR. Jeanne