jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22044
Joined: Sat Jul 30, 2011 7:41 pm

Re: Connecting headphones to the onboard sound jack of RPi 3B+ increases WiFi latency a lot.

Thu Mar 28, 2019 10:04 am

OK, you actually encountered something that is being looked in to, unrelated to the sound jack which is clearly a massive red herring.

The regulatory rules for wireless, esp. 5Ghz are onerous. Our chip supplier is being exceptionally cautious with regard to this so they don't get fined for breaching rules. So the firmware that runs on the wireless chip (a cypress device) is very careful in what domains are enabled. This is out of RPI control. I'm not sure what the plan is for the future, but I suspect it will be along the lines of waiting passively for AP's to show up, then switch to the regulatory domain the AP is using. Not great - in an ideal world we would simply enable wireless and it would just work out of the box anywhere in the world, but its not an ideal world. Just to reiterate, this is out of our control, and is down to the various regulations for wireless differeing around the world, and the need for the wireless chip supplier to adhere to those regulations.

Not sure about the poroblem with being too close to the router, not sure what that is.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
sakaki
Posts: 200
Joined: Sun Jul 16, 2017 1:11 pm

Re: Connecting headphones to the onboard sound jack of RPi 3B+ increases WiFi latency a lot.

Thu Mar 28, 2019 10:48 am

crocket,

I appreciate you're not using my gentoo-on-rpi3-64bit image, rather building out your own Gentoo system from scratch, but you may want to take a quick look at the rpi3-overlay used by my project; there are a number of 'fixups' for the RPi3 B/B+ (working around Ethernet glitches on B+, WM compositing with too-high pixel clock on vc4-{f,}kms-v3d, patching ffmpeg to allow v4l2-m2m codec use on the current 4.19 kernel with 64-bit userland etc.) addressed by various ebuilds there. You seem like a pretty sophisticated user, so I will leave it at that - it's a resource you may or may not find useful; up to you.

Nice tip about audio_pwm_mode=2 btw, I will merge that ^-^

hth, sakaki

crocket
Posts: 111
Joined: Thu Mar 07, 2019 12:38 pm

Re: Connecting headphones to the onboard sound jack of RPi 3B+ increases WiFi latency a lot.

Thu Mar 28, 2019 12:34 pm

jamesh wrote:
Thu Mar 28, 2019 10:04 am
The regulatory rules for wireless, esp. 5Ghz are onerous. Our chip supplier is being exceptionally cautious with regard to this so they don't get fined for breaching rules. So the firmware that runs on the wireless chip (a cypress device) is very careful in what domains are enabled. This is out of RPI control. I'm not sure what the plan is for the future, but I suspect it will be along the lines of waiting passively for AP's to show up, then switch to the regulatory domain the AP is using. Not great - in an ideal world we would simply enable wireless and it would just work out of the box anywhere in the world, but its not an ideal world. Just to reiterate, this is out of our control, and is down to the various regulations for wireless differeing around the world, and the need for the wireless chip supplier to adhere to those regulations.
Fortunately, Raspberry Pi 3 B+ has a WiFi chipset that can operate at almost all frequencies when its regulatory domain is world.

If you set the regulatory domain of Raspberry Pi's onboard WiFi chipset to world, it will be forced to connect to a wireless AP at the frequencies within the AP's regulatory domain since the wireless AP cannot operate outside its regulatory domain.

Since I'm a home user, no one is going to fine me for setting onboard WiFi's regulatory domain to world.

Because its default regulatory domain is world, I don't have to do anything.

I suspect 802.11ax can make regulatory domain unnecessary because it supports BSS coloring, full-duplex communication, and various other features that make wireless traffic very efficient.
jamesh wrote:
Thu Mar 28, 2019 10:04 am
Not sure about the poroblem with being too close to the router, not sure what that is.
I suspect that when any wireless device is too close to another, they cannot communicate properly due to physical issues.
sakaki wrote:
Thu Mar 28, 2019 10:48 am
you may want to take a quick look at the rpi3-overlay used by my project; there are a number of 'fixups' for the RPi3 B/B+ (working around Ethernet glitches on B+, WM compositing with too-high pixel clock on vc4-{f,}kms-v3d, patching ffmpeg to allow v4l2-m2m codec use on the current 4.19 kernel with 64-bit userland etc.) addressed by various ebuilds there. You seem like a pretty sophisticated user, so I will leave it at that - it's a resource you may or may not find useful; up to you.
I browsed rpi3-overlay and realized I needed to just copy /lib/firmware/brcm from raspbian to /lib/firmware on my gentoo system.
rpi3-overlay is a cool reference.
You may not have to set regulatory domain because world regulatory domain is totally fine for a home user like me.
sakaki wrote:
Thu Mar 28, 2019 10:48 am
Nice tip about audio_pwm_mode=2 btw, I will merge that ^-^

hth, sakaki
As far as I know, audio_pwm_mode=2 is an experimental driver. That's why it's not documented yet.

You can glean more of useful bits from My killer optimizations for Gentoo Linux on Raspberry Pi 3 B+.

crocket
Posts: 111
Joined: Thu Mar 07, 2019 12:38 pm

Re: Connecting headphones to the onboard sound jack of RPi 3B+ increases WiFi latency a lot.

Fri Mar 29, 2019 4:10 pm

sakaki wrote:
Thu Mar 28, 2019 10:48 am
Nice tip about audio_pwm_mode=2 btw, I will merge that ^-^
At first, I recommended adding the following lines to /boot/config.txt

Code: Select all

audio_pwm_mode=2
disable_audio_dither=1
pwm_sample_bits=16|24
It turned out that fiddling with disable_audio_dither and pwm_sample_bits only decreased audio quality.
I concluded that adding only audio_pwm_mode=2 to /boot/config.txt is the best for audio quality.

Return to “Gentoo”