DRAgon715205
Posts: 78
Joined: Wed Apr 02, 2014 11:46 am

raspberry pi 4B PWM audio do not work

Thu Mar 19, 2020 12:06 pm

Dear :

I use lastest 2020-02-05-raspbian-buster-full .

I add

Code: Select all

dtoverlay=pwm
this code at config.txt

but GPIO18 do not have audio output but can hear sound form earphone jack at raspberry pi 4B,

the same iamge and sd card, GPIO18 have audio output at raspberry pi 3B

So what can I do to enable pwm audio at 4B >?

thanks

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4111
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: raspberry pi 4B PWM audio do not work

Thu Mar 19, 2020 12:30 pm

Pi 4 has two different PWM controllers. The new one, PWM1, is wired to the headphone outputs. PWM0 is available for the GPIOs on the 40-pin header. The firmware can route sound to either of the two controllers, but not to both. The firmware attempts to detect whether either pin has been reassigned and if so divert the audio to PWM0, but this appears not to be working.

Can you create an issue at https://github.com/raspberrypi/firmware/issues?

DRAgon715205
Posts: 78
Joined: Wed Apr 02, 2014 11:46 am

Re: raspberry pi 4B PWM audio do not work

Thu Mar 19, 2020 12:39 pm

So now I can not solve this problem?

I need wait update ?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4111
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: raspberry pi 4B PWM audio do not work

Thu Mar 19, 2020 12:43 pm

Yes, unfortunately, you will need an updated firmware.

DRAgon715205
Posts: 78
Joined: Wed Apr 02, 2014 11:46 am

Re: raspberry pi 4B PWM audio do not work

Thu Mar 19, 2020 12:54 pm

thank you very much

benjamin2044
Posts: 5
Joined: Mon Jul 29, 2019 1:26 am

Re: raspberry pi 4B PWM audio do not work

Wed Apr 15, 2020 8:13 am

dtparam=audio=on
audio_pwm_mode=2
dtoverlay=audremap,pins_12_13

works like charm

previous version of Raspi used following settings
dtoverlay=pwm-2chan,pin=12,func=2,pin2=13,func2=2

fuwen0202
Posts: 18
Joined: Sat Mar 07, 2020 12:51 pm

Re: raspberry pi 4B PWM audio do not work

Thu Jun 04, 2020 9:22 am

i have try GPIO12and13,with “dtoverlay=audremap,pins_12_13“ and let ”dtparam=audio=on“ without “#”
it can works will,but enable_jack=on, can not let 3.5AUX output in the sametime.

and "dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4" can not work. i think it need mapping.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4111
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: raspberry pi 4B PWM audio do not work

Thu Jun 04, 2020 9:43 am

On Pi 4 there are two PWM blocks - one is available on GPIO 12 & 13 (the 40-pin header), while the other is available on 40 & 41 (the headphone jack). Using both pairs of outputs simultaneously would require that the firmware writes the same data to both PWM blocks, and that is something it won't do. What it will do is work out which PWM block to use by looking at the Device Tree to work out whether the user is trying to use GPIOs 12 & 13.

Return to “Device Tree”