Showing results for 
Search instead for 
Did you mean: 

Enabling MCLK on SAI2 (STM32H745I-DISCO)

Associate II

I am posting this more as an open question, and perhaps to help someone else...

When configuring SAI2 for Audio in CubeMX I had some issues which stemmed from MCLK not appearing to work correctly for the Audio Codec. This would cause the wm8994 to become unresponsive after setting WM8994_AIF1_CLOCKING1 to expect AIF1 Clock Source = MCLK1 pin.

After some investigation I realised that the call to __HAL_SAI_ENABLE(&hsai...) was not being auto-generated from the config.

Adding it in the User Code section resolved the issue for me.

So my questions are..

  1. Should I expect this code to be autogenerated?
  2. Am I perhaps missing somewhere in Pinout & Configuration where I should enable this?

All other settings for SAI2; GPIO, DMA etc all seem to be generatred correctly from the config, just not this last part to enable MCLK.

Chief II

This is normal for all peripherals generator setup it , but not start.

Associate II

Thanks for the clarification. I guess I didn't consider SAI to be a "periperal" in that sense as it's part of the SoC.