AnsweredAssumed Answered

Line In on STM32F7xx boards - not working

Question asked by jaekel.torsten on Dec 5, 2017

Have you realized that the Line In on STM32F7xx DISCOVERY board, even supported in HAL and BSP - is not working? It sounds strange (just very loud noise and distortions, you might fight days to get it working).
I am also surprised why the bug (in WM8994 configuration) is there since years and never realized and still not fixed in latest CubeF7 drivers (and BSP).

 

The issue is (what I have found):
The WM8994 on DISCOVERY boards (where used, e.g. STM32F723, STM32F769 board) configures Line In properly. But it configures also an analog mix from the output to the input, inside the WM8994 Codec. This results in a feedback (loopback) from the output to the input (as analog signal). Especially if Line In is used - it is a feedback of the same signal (LineIn from ADC via SAI I2S as SAI I2S out to DAC) and results in an oscillation (where the "noise" frequency depends on your buffer size, a bit of audio you can still hear but at the end: all is oscillation and saturation).

 

Check the config in wm8994.c file for this mode, esp. look for analog mixer enabled which feeds the output (DAC) back to the input (INx to the analog MUX).

This fix is working for me:

      //XXXX VERY IMPORTANT !!!!
      //ATT: disable (mute) IN1 feedback to Mixer !
      counter += CODEC_IO_Write(DeviceAddr, 0x29, 0x0020);
      //ATT: disable (mute) IN1 feedback to Mixer !
      counter += CODEC_IO_Write(DeviceAddr, 0x2A, 0x0020);

 

(sometimes, it helps to check against the data sheet, do not trust that all code is really tested and working     )

Outcomes