2014-02-07 06:12 AM
Hello Everyone,
I am totally new to the world of embedded systems. Please pardon me if my question is too simple.I have been asked to generate any kind of sound on a small speaker(needs to be attached to the STM32F103RE board)..The main point would to use the PWM of the STM32. I am willing to investigate myself,but I haven't got any head or toe where to start.Please explain as if you are explaining a layman. Thanks a lot...A beer on me!!!2014-02-07 06:30 AM
Homework?
''Any sound using PWM'' may mean two things: - using PWM as a form of output toggle to create square-wave sound - or using PWM as a DAC replacement to create any waveform The former is simpler, you simply set the timer to audible frequency and set PWM to say 50%. STM32F10x_StdPeriph_Lib_V3.4.0\Project\STM32F10x_StdPeriph_Examples\TIM\ contains PWM examples. Google is your friend. JW2014-02-07 12:32 PM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/How%20can%20create%20a%20tone%20with%20timer&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx¤tviews=51]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fHow%20can%20create%20a%20tone%20with%20timer&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FAllItems%2Easpx¤tviews=51
2014-02-11 04:13 AM
Hi..
Yes its homework sort of.... thanks for your support.I am still on it..Using elua...have set duty cycle to 50% , and setting the audible frequency to about 10,000 HZ,selected the channel and the frequency..no results yet..let me check if we can have any alternative solution...will post it once found..cheerss!!2014-02-11 04:22 AM
Hi
''I have been asked to generate any kind of sound on a small speaker(needs to be attached to the STM32F103RE board).'' The STM32 output will not be able to drive a speaker directly. You will need an amplifier of some kind. You may actually be getting an output, just you cannot hear it because the output port does not have enough drive to work the speaker. Do you have access to an oscilloscope?2014-02-11 04:37 AM
Thanks clive1.....indeed a lot of info available in the forum..let me have a thorough look..cheerss