cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 discovery audio line-in

konrad2399
Associate II
Posted on October 06, 2015 at 21:10

Hi.

I've started to play with STM32F7 discovery. I got to DSP audio example from hands-on and I would like to use line-in instead of microphones. Unfortunately when I've changed

BSP_AUDIO_IN_OUT_Init(INPUT_DEVICE_DIGITAL_MICROPHONE_2, OUTPUT_DEVICE_HEADPHONE, 90, DEFAULT_AUDIO_IN_FREQ);

to

BSP_AUDIO_IN_OUT_Init(INPUT_DEVICE_INPUT_LINE_1, OUTPUT_DEVICE_HEADPHONE, 90, DEFAULT_AUDIO_IN_FREQ);

Only thing that's coming is noise. Could anyone help me to get line-in working? Best regards Konrad #https://github.com/laurent-lator #stm32f7-audio
24 REPLIES 24
briancavanagh91
Associate II
Posted on November 04, 2015 at 00:20

I have been able to get recognizable audio in from line1 in pass it immediately back to headphone output.

Only problem is, the line1 input is mixed with noise (at about 5mvolts) from an unknown source, that is not correlated with dma interrupt rate.

I was able to mitigate the noise to a slight extent by using the dynamic range features of the m8994 codec, but the input noise is still too great for enjoyable listening.

The noise happens only when the input drive train (sai, dma, mixers, etc) is active, whether or not any line in source is plugged in.

 

briancavanagh91
Associate II
Posted on November 04, 2015 at 03:43

There was no hissing noise in the headphone output when a sound was synthesized and set to the headphone without the input stream activated.

Christopher Pappas
Senior II
Posted on November 05, 2015 at 02:33

That's amazing that you got the Line-In to work at all.

The conclusion of

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/STM32F746-Discovery,%20Audio%20Line%20In%20jack%20not%20supported%20for%20SW4STM

is that the TDM slots for the Headphone-Out and the Line-In can be used separately, but not both at the same time. They occupy the same TDM slots. The Digital Microphone occupies a different time slot than the Headphone-Out does, and that is why they can be used simultaneously.

Do you mind sharing the changes you made to the BSP driver code in order to get the Line-In jack to work? I would be interested to try it out.

briancavanagh91
Associate II
Posted on November 05, 2015 at 04:06

I read the BSP stuff but wanted simultaneous input and output.  I'll post some code as soon as I can.  Maybe headphone and line1 digital data are superimposed in timeslot0.

I hope not.

briancavanagh91
Associate II
Posted on November 06, 2015 at 03:13

I hope to attach a zip file to this post which contains source and binary code for an example project that copies line1 incoming data to the headphone output. Unfortunately it includes too much unwanted noise.

If anybody figures out why there is excess noise in the resulting output stream, please post it in this thread.

________________

Attachments :

Stm32F7Audio.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzjM&d=%2Fa%2F0X0000000bOm%2F4lp0to2SI2EAhUAiFT4xLl81tw6xKbFkYyKxLbDU9kA&asPdf=false
Christopher Pappas
Senior II
Posted on November 06, 2015 at 15:32

What combination of GCC/IDE are you using for your code? I'm trying to import it into SW4STM, but it can't recognize the platform.

Meanwhile, I did load the binary and ran the app. I get about 10 millivolts pp of white noise, and with a 0db line input, I am getting just a trace at the headphones output (in the single microvolts pp). If I boost the input to +9db, I can hear the codec driven into clipping. It almost seems like the input signal is just leaking somewhere in the codec (maybe at the spec of crosstalk for the mixer).

Interesting though, it is the first time I have heard any signal pass thru from Line-In to HP Out.

If I can get the code imported (or just switch the GCC/IDE that you are using now and directly compile the code) I will try some quick ideas with gains on the codecs mixer settings.

 

briancavanagh91
Associate II
Posted on November 06, 2015 at 16:02

I'm using the EmBitz, formerly EmBlocks, IDE available from emblocks.com.

But I didn't include the project file in the upload. A more complete project zip is included here.

________________

Attachments :

STM32F7AudioEmblocks.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzjH&d=%2Fa%2F0X0000000bOk%2FpXh6U5wInzVianMA3EUzF6f_ep56NjxuJKLqcyTP_9M&asPdf=false
briancavanagh91
Associate II
Posted on November 06, 2015 at 18:34

Left out loader file.

Here it is.

________________

Attachments :

STM32F746NGHx_FLASH.ld : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzj7&d=%2Fa%2F0X0000000bOl%2F3J6ZRKV8E4tgNWlgm6OG7jkWVvwRnS7IhOi9tEpLaLQ&asPdf=false
Christopher Pappas
Senior II
Posted on November 06, 2015 at 21:46

Ok, I got Embitz installed now, and I am able to build your app.

If I try setting the input back to Digital Mic 2, I get no noise, and no mic sounds.

I will try looking at the code in more detail now.