cancel
Showing results for 
Search instead for 
Did you mean: 

How To Play Digitally Generated Sine Wave

Nhyrane
Associate II

I just finish a TouchGFX code to generate an adjustable sine wave. I am planning to make 3 of them to mix them and play chords but there is a problem: how can i play a function that generated in STM32 on the speakers of that STM32?

I would be so glad to any help from you all.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,


@Nhyrane wrote:

I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.


In that case, you need to use the audio codec on the board.

SofLit_0-1721809126874.png

And its BSP driver from the link: 

https://github.com/STMicroelectronics/32f746gdiscovery-bsp/blob/64c20f758a907cd873e368502cf16e498934d0ec/stm32746g_discovery_audio.c

And refer to the audio example:

https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32746G-Discovery/Applications/Audio/Audio_playback_and_record

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
Andrew Neil
Evangelist III

PWM ?

DAC ?

 

A speaker would likely also require an amplifier/driver of some sort ...

TDK
Guru

Broadly speaking, you would send them to the speaker. Does your board have a speaker? What hardware are you working with?

If you feel a post has answered your question, please click "Accept as Solution".

I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.

Hello,


@Nhyrane wrote:

I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.


In that case, you need to use the audio codec on the board.

SofLit_0-1721809126874.png

And its BSP driver from the link: 

https://github.com/STMicroelectronics/32f746gdiscovery-bsp/blob/64c20f758a907cd873e368502cf16e498934d0ec/stm32746g_discovery_audio.c

And refer to the audio example:

https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32746G-Discovery/Applications/Audio/Audio_playback_and_record

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@Nhyrane wrote:

I work with STM32F746G-Disco board.


Remember that we can't read your mind, or see what's on your desk - that's why it's important to include these details in your post:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 


@Nhyrane wrote:

It has stereo output (two jacks).


So, from the User Manual, you'll know that they are connected to the external Audio DAC & Amplifier:

AndrewNeil_0-1721813444262.png

AndrewNeil_1-1721813542169.png

 

 

Thanks for your time and patience. That was my very first blog post but i will take account of your advice. Thanks again for guidance. Have a nice one.