Skip to main content
SNort.1
Associate II
January 3, 2022
Question

Enabling MCLK on SAI2 (STM32H745I-DISCO)

  • January 3, 2022
  • 2 replies
  • 1063 views

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.

This topic has been closed for replies.

2 replies

MM..1
Chief III
January 3, 2022

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

SNort.1
SNort.1Author
Associate II
January 4, 2022

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.