Hi Alexander,
Pwm audio is working fine,but some noise came.
Thanks for your support.
Thanks & Regards,
Sankar.
Hi Alexander,
Yes,we are using 1.5k only.
We are using 1W and 8Ohm speaker,full noise coming from speaker.
Hi Alexander,
Thanks for sharing valuable information.
Actually our requirement is play some raw files through pwm out.
So,if possible can you help us to some check points for exact problem(from speaker full noise is coming) its either driver or circuit?
Same driver is working fine from your end or you modified the driver for playing wav files.
We cross verified the registers of the imx6ul and imx6ull datasheets,both are using same registers and working functionality also same.
Thanks & Regards,
Sankar.
Hi Sankar.
We use the same driver and filter, but I would like to clarify - the nominal value of resistors r15, r17, r19 is 1.5 kOhm, it's hard to see in the screenshot.
Alexander
Hi Alexander,
We are also playing 16 bit,8 bit and 8KHz .wav files.
PWM pin generates 7.84 KHz from driver,but noise is coming with amplifier and with your suggested circuit noting is coming form speaker.
Something we have to modify in driver or same driver will work ?
can you please help us where we are wrong,actually we are struck in pwm audio.
Thanks & Regards,
Sankar.
Hi Sankar.
The use of conventional PWM is an alternative solution and I agree with Igor - it is better to use SAI + MQS because they have many advantages
1 support DMA out of the box
2 multiple supported sampling rates and two channels for stereo sound
3 ready-made drivers from the manufacturer
Alexander
Hi Alexander,
We tried all the 8 pwms,but we faced the same issue.
while playing : aplay a2002011001-e02-8kHz.wav
Playing WAVE 'a2002011001-e02-8kHz.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Some sound coming but its not actual .wav file,full noise is coming.
Can you please help to resolve this issue.
Thanks & Regards,
Sankar.
Hi Sankar.
We use a third-order RC filter with a 4kHz band without an amplifier.
Alexander
Hi Alexander,
We implemented above circuit on general perpose board.
while playing : aplay a2002011001-e02-8kHz.wav
nothing is coming out from speaker.
on oscilloscope monitor that on c5 one end puls signal is clipping(we are getting before R14 8KHz)
Thanks & Regards,
Sankar
Hi Alexander,
We are waiting for your suggestion..
Thanks & Regards,
Sankar.
Hi Alexander,
If we are using wrong amplifier,can you please suggest any pwm power amplifier for playing .wav and mp3.
Thanks & Regards,
Sankar.
Hi Alexander,
Now aplay: pcm_write:2004: write error: Input/output error is solved.
But while playing .wav file some disturbance is coming (not able to listen).
We are using attached schematic for pwm audio.
It is correct or con you suggest any example schematic for pwm audio.
Hi Alexander,
I got logs like below
root@phyboard-segin-imx6ul-2:~# dmesg | grep "ALSA" -A 3
[ 2.363591] ALSA device list:
[ 2.366577] #0: imx PWM audio
[ 2.384447] EXT4-fs: Warning: mounting with data=journal disables delayed allocation and O_DIRECT support!
[ 2.394270] EXT4-fs (mmcblk0p2): mounting ext3 file system using the ext4 subsystem
root@phyboard-segin-imx6ul-2:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxsndpwm [imx-snd-pwm], device 0: snd_pwm_imx [imx-snd-pwm DAC]
Subdevices: 1/1
Subdevice #0: subdevice #0
But whilew playing .wav file i got some Input/output error like below.
root@phyboard-segin-imx6ul-2:~# aplay test.wav -vvv
Playing WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Plug PCM: Hardware PCM card 0 'imx-snd-pwm' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : U8
subformat : STD
channels : 1
rate : 8000
exact rate : 8000 (8000/1)
msbits : 8
buffer_size : 4000
period_size : 1000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 1000
period_event : 0
start_threshold : 4000
stop_threshold : 4000
silence_threshold: 0
silence_size : 0
boundary : 2097152000
appl_ptr : 0
hw_ptr : 0
Max peak (1000 samples): 0x00000018 #### 18%
Max peak (1000 samples): 0x00000038 ######### 43%
Max peak (1000 samples): 0x0000002c ####### 34%
Max peak (1000 samples): 0x00000041 ########### 50%
Max peak (2 samples): 0x00000021 ###### 25%
aplay: pcm_write:2004: write error: Input/output error
Can you help me where i am wrong?
Thanks & Regards,
Sankar.
Hi Alexander,
Thanks for reply.
This driver will work for imx6ul ?
we are using pwm3 for audio,please find my devicetree file
&pwm3 {
compatible = "fsl,imx-snd-pwm";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm3>;
clocks = <&clks IMX6UL_CLK_PWM3>,
<&clks IMX6UL_CLK_PWM3>;
status = "okay";
};
Is it okay or i have to modify ?
can you please provide some examples to test the pwm audio.
Thanks & Regards,
Sankar.
Hi Sankar.
We use this driver on imx6ull but it should work and for imx6ul, devicetree looks correct.
First, you need to check that the device is in the list of devices for audio playback (in my example the driver is statically linked)
# dmesg | grep "ALSA" -A 3
ALSA device list:
#0: imx PWM audio
random: fast init done
EXT4-fs (mmcblk1p1): INFO: recovery required on readonly filesystem# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxsndpwm [imx-snd-pwm], device 0: snd_pwm_imx [imx-snd-pwm DAC]
Subdevices: 1/1
Subdevice #0: subdevice #0
now you can use any sound player
wget http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02-8kHz.wav -O - | aplay
Connecting to www.music.helsinki.fi (128.214.222.15:80)
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
- 100% |*******************************| 1697k 0:00:00 ETA
mplayer http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02-128k.mp3
MPlayer 1.3.0-6.3.1 (C) 2000-2016 MPlayer Team
Playing http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02-128k.mp3.
Resolving www.music.helsinki.fi for AF_INET...
Connecting to server www.music.helsinki.fi[128.214.222.15]: 80...Cache size set to 320 KBytes
Cache fill: 8.85% (28993 bytes)
Resolving www.music.helsinki.fi for AF_INET...Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Connecting to server www.music.helsinki.fi[128.214.222.15]: 80...
Resolving www.music.helsinki.fi for AF_INET...
Cache empty, consider increasing -cache and/or -cache-min. [performance issue]
Connecting to server www.music.helsinki.fi[128.214.222.15]: 80...
Audio only file format detected.
Clip info:
Title: J.S.Bach: Partita E major, Gav
Artist: Sirkka V�is�nen, vl.
Album:
Year:
Comment:
Genre: Unknown
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 57.24.102 (internal)
AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/4.54% (ratio: 16000->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 53.7 (53.6) of 54.0 (54.0) 8.5% 0% $<50>
Exiting... (End of file)
Alexander
Hello,
there is an ALSA driver for playing any sound
GitHub - sasamy/imx-snd-pwm: A simple sound card based on PWM for i.mx6x processors
Alexander
Hi Sankar
as suggests "pwm-beeper", seems only monotonous sound "beep" can
be achieved with that driver. For sound recommended to use MQS module,
available for example in i.MX6UL.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------