cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f427 SAI Clock Problems

jowen
Associate II
Posted on October 30, 2015 at 14:56

Hi

I am struggling to get the External Audio Clock Input (PC9 12.288MHZ) to be output by the SAI Master clock pin PF7. I have used STM32Cube  to set it up and it all looks ok,  but I can not get any output on the SAI Master Clock even if i try and use the internal PLL clock. I am trying to communicate with a SSM2604 codec, I can see the clock is correct on the  SAI_SCK_B (PF8) and I get a pulse on SA1_FS_B but SA1_MCLK is Dead I am using SAI_B in master mode with Master Clock Out.

Any Help, examples etc would be gratefully received

Thanks

John
4 REPLIES 4
Posted on October 30, 2015 at 16:49

Post content of relevant SAI registers.

JW

jowen
Associate II
Posted on November 02, 2015 at 14:08

Part of my problem is that the debug SAI section is missing for STM32F427ZIT chip I have reported this to ST and they are implementing a fix. So I rebuilt my code for the STM32F429ZIT so I could then play with the MCKDIV reg Currently it is set to 0 and the NODIV value is also 0 (the actual value of SAI_BCR1 is 0x001120C0) which should put the SAI_CK_B clock out on MCLK_B but it doesn't but when I change MCKDIV to a non zero value ie 1 I get a MCLK_B but divided by the MCKDIV so 6.144MHZ but I want 12.288MHZ any ideas?

jowen
Associate II
Posted on November 02, 2015 at 17:26

A bit More info

Ok This is strange

if I use this code

  hsai_BlockB1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_96K; // SAI_AUDIO_FREQUENCY_MCKDIV; //

 

then in debug manually set   Mckdiv= 0x01 The MCLK Start working

but if i set

  hsai_BlockB1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_MCKDIV;

  hsai_BlockB1.Init.Mckdiv= 1;

then the MCLK does not start regardless of what I change in debug

but if Initialize Block B1 with

hsai_BlockB1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_96K;

and then  after HAL_SAI_Init(&hsai_BlockB1); set

hsai_BlockB1.Instance->CR1=0x001120C1;

MCLK works at half clock, I can not get it to run with Mckdiv set to zero

But hsai->Init.AudioFrequency  only appears to be used calculate MCKDIV but if it is not set to  SAI_AUDIO_FREQUENCY_96K it does not work?