2016-06-03 02:17 AM
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,Florian2016-06-03 03:22 AM
Hi ch..florian,
I report this internally to our CubeMx team for check. -Hannibal-2016-06-07 12:09 AM
Hello Hannibal,
Thank you for reporting this. Do you have any news about my questions ?Florian2018-01-11 02:41 AM
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 (
).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 :
In slave mode, the SAI is receiving the timing signals from an external device :
And in salve mode, the MCLK (master clock) is not used.
Sorry for the late answer...
BR
Jeanne
2018-01-18 01:29 PM
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
2018-01-19 02:01 AM
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) :
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 :
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 :
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
2018-01-19 02:50 AM
I am not the original poster, and I don't use Cube/CubeMX.
So, while the question was formulated in terms of CubeMX (why can SAIx clock be set in CubeMX if both SAIx channels are slaves), the implication of the question was: If both channels of one SAI channel are slaves, does it need input clock on its sai_*_ker_ck terminals?
JW
2018-01-19 03:46 AM
Regarding your question, yes, you need an input clock for the SAI clock generator whatever the mode (slave, master) of the SAI channels.
BR. Jeanne
2018-01-20 04:09 AM
Wow. This is strange, as:
What's the purpose of the input clock in slave mode, then? And, more importantly, what should be its frequency (perhaps in relationship to input FS/SCK frequency)?
Can you please point out, where in RM is this dealt with?
Thanks,
JW
2018-06-23 09:56 AM
Did we get a proper answer on this?
we need an RCC clock to drive SAIx even if both SAIx_Block_A & SAIx_Block_B are set to slave and use CK and FS ??
how do we calculate the appropriate RCC clock for this ? my external DSP will change CK FS depending on mode.