Page 1 of 2

[SOLVED] Connecting headphones to the onboard sound jack of RPi 3B+ increases WiFi latency a lot.

Posted: Wed Mar 27, 2019 9:41 am
by crocket
WiFi almost froze.
I had to disconnect it so that I could use WiFi. Why does it happen?

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

Posted: Wed Mar 27, 2019 9:43 am
by jamesh
It shouldn't.

Can you try a different set of headphones?

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

Posted: Wed Mar 27, 2019 11:38 am
by crocket
jamesh wrote:
Wed Mar 27, 2019 9:43 am
It shouldn't.

Can you try a different set of headphones?
It seems to be that the problem is "CTRL-EVENT-ASSOC-REJECT status_code=16" from wpa_supplicant.
I don't know why it is triggered. But, it seemed to be triggered by plugging headphones in.

Once it starts rejecting wifi connections, it's difficult to fix the issue.

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

Posted: Wed Mar 27, 2019 11:48 am
by LTolledo
I just unplugged the LAN and enabled WiFi

then I plugged my Sony Headphone to the headphone jack
set audio to output from DAC ( I have a clone hifiberry DAC on top of RPi3B+) to RPi headphone

seems to be working fine...
watching some youtube video as I was testing this....

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

Posted: Wed Mar 27, 2019 12:03 pm
by crocket
Now, the error from wpa_supplicant is

Code: Select all

CTRL-EVENT-SCAN-FAILED ret=-110
It fails to scan WiFi networks. After rebooting, I keep saying "CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16" again.

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

Posted: Wed Mar 27, 2019 12:07 pm
by jamesh
crocket wrote:
Wed Mar 27, 2019 11:38 am
jamesh wrote:
Wed Mar 27, 2019 9:43 am
It shouldn't.

Can you try a different set of headphones?
It seems to be that the problem is "CTRL-EVENT-ASSOC-REJECT status_code=16" from wpa_supplicant.
I don't know why it is triggered. But, it seemed to be triggered by plugging headphones in.

Once it starts rejecting wifi connections, it's difficult to fix the issue.
There's no physical connection from that plug to the wireless chip, so this is a bit strange. Do you have another plug, not necessarily a headphone, but a 3.5mm plug that you can try to see if it promotes the same issue? Doesn't need to be connected to anything, just want to check the act of plugging it is causing this.

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

Posted: Wed Mar 27, 2019 12:09 pm
by B.Goode
Are the headphones hardwired to the RPi with a cable and trrs jack? Or does the audio jack feed some sort of wireless connection to the headset?

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

Posted: Wed Mar 27, 2019 12:15 pm
by LTolledo
B.Goode wrote:
Wed Mar 27, 2019 12:09 pm
....Or does the audio jack feed some sort of wireless connection to the headset?
....something like a headphone to bluetooth transmitter perhaps?
lemme find mine.... lying here somewhere..... somewhere........

but I do doubt it can cause any problems.... ( I do need to confirm this when I finally find it and plug it to the audio jack)....

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

Posted: Wed Mar 27, 2019 12:16 pm
by crocket
Now, only UART GPIO pins are connected to Raspberry Pi 3 B+. I see the following messages from dmesg.

Code: Select all

[   11.927094] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[   11.927914] usbcore: registered new interface driver brcmfmac
[   12.063674] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[   12.063957] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[   12.064564] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar  1 2015 07:29:38 version 7.45.18 (r538002) FWID 01-6a2c8ad4
[   17.285692] brcmfmac: power management disabled
[   18.582891] brcmfmac: power management disabled
[   28.091405] brcmfmac: brcmf_sdio_hostmail: mailbox indicates firmware halted
[   30.563440] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   33.123433] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   33.123466] brcmfmac: brcmf_pno_clean: failed code -110
[   40.675449] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
[   40.675474] brcmfmac: brcmf_run_escan: error (-110)
[   40.675494] brcmfmac: brcmf_cfg80211_scan: scan error (-110)
[   44.195451] brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
I realized that I had to set regulatory domain. I installed crda and executed "iw reg set XX" and added "country=XX" to /etc/wpa_supplicant/wpa_supplicant.conf. But, scanning still fails.

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

Posted: Wed Mar 27, 2019 12:18 pm
by crocket
B.Goode wrote:
Wed Mar 27, 2019 12:09 pm
Are the headphones hardwired to the RPi with a cable and trrs jack? Or does the audio jack feed some sort of wireless connection to the headset?
My speakers and my headphones have TRS jacks. My headphones have nothing to do with wireless connection. It is Audio-Technica M40X.

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

Posted: Wed Mar 27, 2019 12:53 pm
by Ernst
crocket wrote:
Wed Mar 27, 2019 9:41 am
WiFi almost froze.
I had to disconnect it so that I could use WiFi. Why does it happen?
What operating system / release are you using when the problem occurs.
Please provide the output of the following commands:

Code: Select all

cat /etc/os-release
uname -a

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

Posted: Wed Mar 27, 2019 1:16 pm
by crocket
Ernst wrote:
Wed Mar 27, 2019 12:53 pm
What operating system / release are you using when the problem occurs.
Please provide the output of the following commands:

Code: Select all

cat /etc/os-release
uname -a

Code: Select all

$ cat /etc/os-release
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo/Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"

[email protected]+ ~ $ uname -a
Linux rpi3b+ 4.19.30-v8+ #3 SMP PREEMPT Sun Mar 24 10:15:49 2019 aarch64 GNU/Linux
I compiled a recent commit from rpi-4.19.y branch of raspberrypi kernel.

Somehow, if wpa_supplicant.conf has country=XX, scan fails. Without country=XX, scan succeeds, but connection is rejected.

A weird thing is that it can still connect to another wireless router in another room. It just refuses to connect to my wireless router. But, my smartphone can still connect to my wireless router.

I suspect that the issue might be https://bugzilla.kernel.org/show_bug.cgi?id=201853

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

Posted: Wed Mar 27, 2019 2:05 pm
by jamesh
crocket wrote:
Wed Mar 27, 2019 1:16 pm
Ernst wrote:
Wed Mar 27, 2019 12:53 pm
What operating system / release are you using when the problem occurs.
Please provide the output of the following commands:

Code: Select all

cat /etc/os-release
uname -a

Code: Select all

$ cat /etc/os-release
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo/Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"

[email protected]+ ~ $ uname -a
Linux rpi3b+ 4.19.30-v8+ #3 SMP PREEMPT Sun Mar 24 10:15:49 2019 aarch64 GNU/Linux
I compiled a recent commit from rpi-4.19.y branch of raspberrypi kernel.

Somehow, if wpa_supplicant.conf has country=XX, scan fails. Without country=XX, scan succeeds, but connection is rejected.

A weird thing is that it can still connect to another wireless router in another room. It just refuses to connect to my wireless router. But, my smartphone can still connect to my wireless router.
Can you try with Raspbian? We cannot offer support on someone else's distro. If it fails on Raspbian as well, then we can put more effort in. Otherwise, you need to talk to the supplier of your Gentoo image for tech support.

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

Posted: Wed Mar 27, 2019 2:12 pm
by crocket
jamesh wrote:
Wed Mar 27, 2019 2:05 pm
Can you try with Raspbian? We cannot offer support on someone else's distro. If it fails on Raspbian as well, then we can put more effort in. Otherwise, you need to talk to the supplier of your Gentoo image for tech support.
You have an assumption that I installed someone else's gentoo image on my microSD card.
I installed gentoo on my microSD card in almost the same way that I installed it on my desktop computer.

I'm figuring out where I can get better support.

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

Posted: Wed Mar 27, 2019 2:23 pm
by fruitoftheloom
crocket wrote:
Wed Mar 27, 2019 2:12 pm
jamesh wrote:
Wed Mar 27, 2019 2:05 pm
Can you try with Raspbian? We cannot offer support on someone else's distro. If it fails on Raspbian as well, then we can put more effort in. Otherwise, you need to talk to the supplier of your Gentoo image for tech support.
You have an assumption that I installed someone else's gentoo image on my microSD card.
I installed gentoo on my microSD card in almost the same way that I installed it on my desktop computer.

I'm figuring out where I can get better support.

You misunderstood, Raspbian is the only officially supported Operating System by the Raspberry Pi Foundation / Raspberry Pi Trading.

https://wiki.gentoo.org/wiki/Raspberry_Pi


Anyway you should post in the Gentoo Section of Forum so Gentoo Users are able to help, I have reported this post to be moved so it can sit with your other posts!

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

Posted: Wed Mar 27, 2019 3:22 pm
by crocket
fruitoftheloom wrote:
Wed Mar 27, 2019 2:23 pm
You misunderstood, Raspbian is the only officially supported Operating System by the Raspberry Pi Foundation / Raspberry Pi Trading.

https://wiki.gentoo.org/wiki/Raspberry_Pi


Anyway you should post in the Gentoo Section of Forum so Gentoo Users are able to help, I have reported this post to be moved so it can sit with your other posts!
The fact that I'm a gentoo user doesn't make this issue relevant or specific to gentoo.
My search results indicate that this issue affects users across many linux distributions.
For example, viewtopic.php?t=196018 and viewtopic.php?t=147151

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

Posted: Wed Mar 27, 2019 4:03 pm
by Ernst
crocket wrote:
Wed Mar 27, 2019 3:22 pm
fruitoftheloom wrote:
Wed Mar 27, 2019 2:23 pm
You misunderstood, Raspbian is the only officially supported Operating System by the Raspberry Pi Foundation / Raspberry Pi Trading.

https://wiki.gentoo.org/wiki/Raspberry_Pi


Anyway you should post in the Gentoo Section of Forum so Gentoo Users are able to help, I have reported this post to be moved so it can sit with your other posts!
The fact that I'm a gentoo user doesn't make this issue relevant or specific to gentoo.
My search results indicate that this issue affects users across many linux distributions.
For example, viewtopic.php?t=196018 and viewtopic.php?t=147151
You are not making friends if you keep this up.

The answer is very simple, we do not care if you have this problem with Gentoo, with Red Hat, with Suse, with SunOS, with Windows,
if you can not reproduce the problem using the official Raspbian release using the official power supply then you will have to go somewhere else for support. This is (was) in the Raspbian troubleshooting forum and it is expected that you are using Raspbian if you do not give other information. If you need help then it is your duty to provide information under which conditions AND expect that we will ask if you can reproduce the problem using the official release.

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

Posted: Wed Mar 27, 2019 4:05 pm
by fruitoftheloom
crocket wrote:
Wed Mar 27, 2019 3:22 pm
fruitoftheloom wrote:
Wed Mar 27, 2019 2:23 pm
You misunderstood, Raspbian is the only officially supported Operating System by the Raspberry Pi Foundation / Raspberry Pi Trading.

https://wiki.gentoo.org/wiki/Raspberry_Pi


Anyway you should post in the Gentoo Section of Forum so Gentoo Users are able to help, I have reported this post to be moved so it can sit with your other posts!
The fact that I'm a gentoo user doesn't make this issue relevant or specific to gentoo.
My search results indicate that this issue affects users across many linux distributions.
For example, viewtopic.php?t=196018 and viewtopic.php?t=147151

The links are irrelevant as it pre-dates the RPi 3B+ hardware...................

....the 3B+ use the Cypress CYW43455

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

Posted: Wed Mar 27, 2019 4:32 pm
by crocket
Ernst wrote:
Wed Mar 27, 2019 4:03 pm
You are not making friends if you keep this up.

The answer is very simple, we do not care if you have this problem with Gentoo, with Red Hat, with Suse, with SunOS, with Windows,
if you can not reproduce the problem using the official Raspbian release using the official power supply then you will have to go somewhere else for support. This is (was) in the Raspbian troubleshooting forum and it is expected that you are using Raspbian if you do not give other information. If you need help then it is your duty to provide information under which conditions AND expect that we will ask if you can reproduce the problem using the official release.
This forum is "Board index > Using the Raspberry Pi > Troubleshooting". I couldn't have guessed that this forum was dedicated to Raspbian from the name.

It's confusing.

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

Posted: Wed Mar 27, 2019 5:34 pm
by jamesh
crocket wrote:
Wed Mar 27, 2019 4:32 pm
Ernst wrote:
Wed Mar 27, 2019 4:03 pm
You are not making friends if you keep this up.

The answer is very simple, we do not care if you have this problem with Gentoo, with Red Hat, with Suse, with SunOS, with Windows,
if you can not reproduce the problem using the official Raspbian release using the official power supply then you will have to go somewhere else for support. This is (was) in the Raspbian troubleshooting forum and it is expected that you are using Raspbian if you do not give other information. If you need help then it is your duty to provide information under which conditions AND expect that we will ask if you can reproduce the problem using the official release.
This forum is "Board index > Using the Raspberry Pi > Troubleshooting". I couldn't have guessed that this forum was dedicated to Raspbian from the name.

It's confusing.
Troubleshooting, yes, but from an Pi engineers point of view, unless the problem is replicatable on Raspbian, we cannot do anything. There are dozen of distro's available for the Raspberry Pi, but the ONLY ONE supported by the Pi engineers is Raspbian, since we know what is in that one. We have no knowledge of other peoples distro's, and do not debug on other people distro's. If it works on Raspbian it is down to the suppliers of other distro's to ensure they are update to date with us. If it doesn't work on Raspbian we will bug fix it.

With regard to your specific problem, that of inserting headphones breaking the wireless, unless you can replicate on Raspbian we cannot do anything.

You might get support from others on here for other OS' (see our other OS section), but TBH, most people use Raspbian as that works, is kept very up to date, and supports all Pi models. Quite often, third party distro's lag behind Raspbian. This may be the case with yours.

Edit: forgot to mention - the links you referred to above are very old, drivers and firmware have both been updated since then, and in the case of the 3B+ the wireless chip has completely changed. So they are probably irrelevent.

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

Posted: Wed Mar 27, 2019 5:44 pm
by crocket
jamesh wrote:
Wed Mar 27, 2019 5:34 pm
With regard to your specific problem, that of inserting headphones breaking the wireless, unless you can replicate on Raspbian we cannot do anything.

You might get support from others on here for other OS' (see our other OS section), but TBH, most people use Raspbian as that works, is kept very up to date, and supports all Pi models. Quite often, third party distro's lag behind Raspbian. This may be the case with yours.

Edit: forgot to mention - the links you referred to above are very old, drivers and firmware have both been updated since then, and in the case of the 3B+ the wireless chip has completely changed. So they are probably irrelevent.
I will try to replicate the problem on Raspbian tomorrow.

I think that when I was pulling out the 3.5mm audio jack hard, power cable could have been affected.
Unstable connection to microUSB power supply can lead to WiFi hiccups. But, I'm not sure, yet.

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

Posted: Wed Mar 27, 2019 6:09 pm
by Ernst
crocket wrote:
Wed Mar 27, 2019 5:44 pm
My wireless router's regulatory domain is KR. But, if RPi's regulatory domain is KR, WiFi scanning breaks. When it is KR, almost all wireless frequencies are disabled on Raspberry Pi's built-in WiFi adaptor.
If RPi's regulatory domain is JP, connections work.
If it is "00", it may or may not work randomly.
If it is "US', it scans but refuses to connect to my wireless router.
IIRC last week I looked up your router IP address and it was shown to be located in Indonesia, why don't you specify ID as the regulatory domain ? (Why don't you show your location in your profile ?, it does help us help you)
crocket wrote:
Wed Mar 27, 2019 5:44 pm
I guess that it is either a user problem or a bug in regulatory domain database. Or, the seller from china sold me a version of Raspberry Pi that blocks many regulatory domains.
All Raspberry Pi 3B+ boards are equal, there are no regional differences concerning regulatory domains.
Have you tried to bring up the problem with Raspbian ? It may well be that the problem can be related to you installing an "experimental" operating system on the Raspberry Pi because the OS sets the regulatory domain.

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

Posted: Wed Mar 27, 2019 6:12 pm
by mahjongg
As this question isn't pertinent to Raspbian, moved the thread to the gentoo section of the forum, where it belongs.
Please don't assume that all distro's for the RPI are alike. What works in Raspbian probably won't work in Gentoo.

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

Posted: Wed Mar 27, 2019 7:11 pm
by crocket
Connecting Audio-Technica ATH-M40X to Raspberry Pi seemed to physically cripple onboard WiFi.

It turned out that the issue with ATH-M40X disappears if I put some distance between my wireless router and Raspberry Pi.
When they are too close together, WiFi can easily be crippled.

Actually, I am fine with world regulatory domain, US regulatory domain, and JP regulatory domain as long as my router is not too close to Raspberry Pi.
Ernst wrote:
Wed Mar 27, 2019 6:09 pm
IIRC last week I looked up your router IP address and it was shown to be located in Indonesia, why don't you specify ID as the regulatory domain ? (Why don't you show your location in your profile ?, it does help us help you)
I'm a KR guy. I'm going to reproduce the issue on raspbian soon. On my gentoo system, there are issues with KR regulatory domain.
With KR regulatory domain, as soon as wpa_supplicant runs, firmware crashes.

Code: Select all

brcmfmac: brcmf_sdio_hostmail: mailbox indicates firmware halted
I guess firmware crashes because KR regulatory domain on my system disables most frequencies that should be part of KR regulatory domain.

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

Posted: Thu Mar 28, 2019 5:18 am
by crocket
Solution

I tested Raspberry Pi on the latest stable version of Raspbian.

With regulatory domain set to KR, most frequencies are disabled. But, for available frequencies, connections can be made properly without crashing WiFi firmware. It seems that I didn't install all firmware files. After copying /lib/firmware/brcm from raspbian into /lib/firmware on my system, WiFi firmware stopped crashing.

I think the issue is solved.

Lesson

1. If Raspberry Pi is too close to wireless router, WiFi connection suffers. Connecting headphones to it when RPi is too close to a wireless router can freeze WiFi.
2. If you don't install all firmware files into /lib/firmware/brcm, WiFi firmware will crash. Just copy /lib/firmware/brcm from raspbian.
3. Although Raspbian artificially blocks world regulatory domain, world regulatory domain works on onboard WiFi.