You are not logged in.

#1 2016-02-04 19:49:06

OOFscr
Member
Registered: 2012-10-06
Posts: 22

rtl8723be wifi connection issues solved by antenna selection

Hi everyone,

I have been struggling with the rtl8723be module for a long while now. First, I had general connection issues with every network, but the (later described) module parameters fixed most of those problems. Finally, in 802.11 b/g networks (up to 54 Mbit/s), my card worked fine, though often slow. But connections to 802.11 n networks were nearly impossible though, spamming:

wlan0: deauthenticating from [ap mac address] by local choice (Reason: 3=DEAUTH_LEAVING)

If I got a 802.11 n connection running, it was very unstable and normally unusable within the first 30 seconds. For months, I went through a lot of troubleshooting threads with no success. I started using the lwfinger/rtlwifi_new repository from github (thanks to lwfinger!) and experimented with several module parameters, but still no luck.

Then, today I stumbled upon these posts (scroll to the bottom, dated ~15th January 2016). Apparently, the rtl8723be chipset supports dual-antenna-wifi, but some manufacturers only build one physical antenna into their products. The windows driver seems to autoselect an antenna in this case, whereas the linux driver just doesn't know that one antenna is disconnected - which of course leads to issues due to great packet loss on one of two channels. Lwfinger contacted Realtek on this, and they delivered an antenna-select driver routine which is now (!) available in the rock.new_btcoex branch in the github repository.

Now, I am using this branch, and after examining and setting my connected antenna port, I finally have a stable (and really fast) 150Mbit-connection to 802.11 n networks for the first time. I am not sure if this branch makes the ant_sel option available to other rtlwifi_new modules than rtl8723be, but at least for people having issues with this specific module, this might be really wonderful news!

I was thinking about editing the Wireless wiki page section on this module, but I wanted to get some feedback first to make sure this solution is not only for me. If this helps you, please comment.

Here are the things you need to do to use the new rtl8723be module from the rock.new_btcox branch - It will give you the rtl8723be module option ant_sel={0,1,2} to select a physical antenna connection (1 or 2, or 0 for default behavior, I suppose). I'll also explain how to examine which antenna is connected in your device.

==============================

IMPORTANT: Try this on your own risk! For me it worked great, but I do not take responsibility for problems you might face or for any damage which might be done to your hardware or software.

==============================

With that in mind, here are the steps:

Make sure that the necessary packages are installed (iw, rfkill and wireless_tools are advised).

pacman -S base-devel git linux-headers iw rfkill wireless_tools

I use several module options from previous troubleshooting research which you might consider. This enables software encryption, disables the watchdog and all power saving by hardware or driver. The ant_sel option is still omitted since we're gonna find out about your antenna number first.

/etc/modprobe.d/rtl8723be.conf
==============================
options rtl8723be fwlps=N ips=N swlps=N swenc=Y disable_watchdog=1

Then, clone the lwfinger/rtlwifi_new repository and checkout the rock.new_btcoex branch.

git clone https://github.com/lwfinger/rtlwifi_new.git
cd rtlwifi_new
git checkout rock.new_btcoex

Now, build the drivers and install the modules.

make clean && make
sudo make install

If sudo make install succeeds, update your initramfs.

sudo mkinitcpio -p linux

Then, reboot your system to make sure you are running the new module. Do not forget to repeat the following steps after EVERY kernel update from now on, otherwise your wifi will probably not work!

# After every kernel update:
cd rtlwifi_new
# Clean previous builds
make clean
# Update git repository
git pull
# Compile
make clean && make
# Install
sudo make install
# Update initramfs
sudo mkinitcpio -p linux

Edit: The most robust solution would be creating an aur-dkms-package which automatically rebuilds the driver with every kernel update. Maybe it should even pull recent changes from the repository before rebuildig, since the antenna select appears to be work in progress and will probably find it's way into the master some day.

After rebooting, you can now examine which antenna port is connected by loading the module with a specific antenna, scanning for networks and comparing the scan results.

sudo rmmod rtl8723be
sudo modprobe rtl8723be ant_sel=1
sudo iwlist wlan0 scan
sudo rmmod rtl8723be
sudo modprobe rtl8723be ant_sel=2
sudo iwlist wlan0 scan

In my case, ant_sel=1 provided a lot more networks with much higher signal strength than ant_sel=2. Finally, you can append the correct ant_sel parameter in your /etc/modprobe.d/rtl8723be.conf, where X is your antenna number.

/etc/modprobe.d/rtl8723be.conf
==============================
options rtl8723be fwlps=N ips=N swlps=N swenc=Y disable_watchdog=1 ant_sel=X

I hope this helps!

Last edited by OOFscr (2016-02-04 21:19:13)

Offline

#2 2016-02-04 20:13:01

OOFscr
Member
Registered: 2012-10-06
Posts: 22

Re: rtl8723be wifi connection issues solved by antenna selection

By the way, if you followed these steps, you are advised to watch the rtlwifi_new github repository closely. It is possible that the antenna select option will be included in the master branch one day.

Offline

#3 2016-02-06 16:34:23

dhalverson
Member
Registered: 2015-12-22
Posts: 20

Re: rtl8723be wifi connection issues solved by antenna selection

This worked for me!!! Thanks so much!!! Mine started working when I typed in this part

OOFscr wrote:

...
sudo modprobe rtl8723be ant_sel=2
...

Just so others know I have a brand new HP Pavilion, also with the rtl7823be wireless card.

Awesome!!! So pumped. Thanks

Offline

#4 2016-02-07 11:32:43

maxaille
Member
Registered: 2015-10-31
Posts: 2

Re: rtl8723be wifi connection issues solved by antenna selection

Seems to work perfectly on my Lenovo Y50-70, thanks guy ! (ant_sel=2 for me)

Offline

#5 2016-02-17 03:18:52

codingquark
Member
Registered: 2016-02-16
Posts: 1

Re: rtl8723be wifi connection issues solved by antenna selection

Works perfectly on my HP AC179TX. Antenna 2 selected.

I think having AUR package will be better because I'm sure I'll forget to compile after kernel update.

Thanks for the solution.

Offline

#6 2016-02-17 09:58:58

OOFscr
Member
Registered: 2012-10-06
Posts: 22

Re: rtl8723be wifi connection issues solved by antenna selection

You're welcome. An AUR package would definitely make sense, but I don't have the time right now to read into dkms to do it the right way. Any help is appreciated here.

Since this is a pure functionality update which will probably not affect "normal" users negatively, I am pretty sure that the ant_sel parameter will be available in the master branch soon. I will ask lwfinger about this and give report here.

Offline

#7 2016-02-17 23:05:02

jeremy31
Member
Registered: 2015-11-01
Posts: 136

Re: rtl8723be wifi connection issues solved by antenna selection

Actually now there is a dkms.conf file in lwfingers github thanks to hanipouspilot AKA Pilot6 on some of the Ubuntu forums

Offline

#8 2016-05-09 04:39:35

Pluck27
Member
Registered: 2016-04-26
Posts: 3

Re: rtl8723be wifi connection issues solved by antenna selection

Now all the branches supports the ant_sel parameter and there's a AUR package with dkms.
I can see a huge diference now that I've changed to ant_sel=2. This should be on the wiki. I suffered for several months trying to get a stable connection and now I have it.

Offline

#9 2016-07-27 11:38:07

dedpul
Member
Registered: 2016-07-25
Posts: 11

Re: rtl8723be wifi connection issues solved by antenna selection

I have the exact same issue on an hp pavilion
I followed the steps , but when I did make clean && make

make -C /lib/modules/4.6.4-1-ARCH/build M=/home/tarun/rtlwifi_new modules
make[1]: Entering directory '/usr/lib/modules/4.6.4-1-ARCH/build'
  CC [M]  /home/tarun/rtlwifi_new/base.o
  CC [M]  /home/tarun/rtlwifi_new/cam.o
  CC [M]  /home/tarun/rtlwifi_new/core.o
  CC [M]  /home/tarun/rtlwifi_new/debug.o
  CC [M]  /home/tarun/rtlwifi_new/efuse.o
  CC [M]  /home/tarun/rtlwifi_new/ps.o
  CC [M]  /home/tarun/rtlwifi_new/rc.o
  CC [M]  /home/tarun/rtlwifi_new/regd.o
  CC [M]  /home/tarun/rtlwifi_new/stats.o
  LD [M]  /home/tarun/rtlwifi_new/rtlwifi.o
  CC [M]  /home/tarun/rtlwifi_new/pci.o
  LD [M]  /home/tarun/rtlwifi_new/rtl_pci.o
  CC [M]  /home/tarun/rtlwifi_new/usb.o
  LD [M]  /home/tarun/rtlwifi_new/rtl_usb.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8723b2ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtcoutsrc.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8192e2ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8723b1ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8821a1ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8821a2ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8812a1ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8812a2ant.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/halbtc8812a_ext.o
  CC [M]  /home/tarun/rtlwifi_new/btcoexist/rtl_btc.o
  LD [M]  /home/tarun/rtlwifi_new/btcoexist/btcoexist.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/dm.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/fw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/hw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/led.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/phy.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/pwrseq.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/pwrseqcmd.o
/home/tarun/rtlwifi_new/rtl8188ee/pwrseqcmd.o: warning: objtool: rtl_hal_pwrseqcmdparsing()+0xab: sibling call from callable instruction with changed frame pointer
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/rf.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/sw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/table.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8188ee/trx.o
  LD [M]  /home/tarun/rtlwifi_new/rtl8188ee/rtl8188ee.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192c/main.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192c/dm_common.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192c/fw_common.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192c/phy_common.o
  LD [M]  /home/tarun/rtlwifi_new/rtl8192c/rtl8192c-common.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/dm.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/fw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/hw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/led.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/phy.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/rf.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/sw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/table.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ce/trx.o
  LD [M]  /home/tarun/rtlwifi_new/rtl8192ce/rtl8192ce.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/dm.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/hw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/led.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/mac.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/phy.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/rf.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/sw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/table.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192cu/trx.o
  LD [M]  /home/tarun/rtlwifi_new/rtl8192cu/rtl8192cu.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/dm.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/fw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/hw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/led.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/phy.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/rf.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/sw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/table.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192de/trx.o
  LD [M]  /home/tarun/rtlwifi_new/rtl8192de/rtl8192de.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ee/dm.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ee/fw.o
  CC [M]  /home/tarun/rtlwifi_new/rtl8192ee/hw.o
/home/tarun/rtlwifi_new/rtl8192ee/hw.c: In function ‘rtl92ee_set_hw_reg’:
/home/tarun/rtlwifi_new/rtl8192ee/hw.c:539:4: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
    if (fac > 0xf)
    ^~
/home/tarun/rtlwifi_new/rtl8192ee/hw.c:541:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
     for (i = 0; i < 4; i++) {
     ^~~
/home/tarun/rtlwifi_new/rtl8192ee/hw.c:545:6: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
      if ((reg[] & 0x0f) > fac)
      ^~
/home/tarun/rtlwifi_new/rtl8192ee/hw.c:547:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
       rtl_write_byte(rtlpriv,
       ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:292: /home/tarun/rtlwifi_new/rtl8192ee/hw.o] Error 1
make[2]: *** [scripts/Makefile.build:440: /home/tarun/rtlwifi_new/rtl8192ee] Error 2
make[1]: *** [Makefile:1429: _module_/home/tarun/rtlwifi_new] Error 2
make[1]: Leaving directory '/usr/lib/modules/4.6.4-1-ARCH/build'
make: *** [Makefile:58: all] Error 2

any ideas?
EDIT: I tried installing it through the AUR. Yaourt says unsupported package. I did it anyway (lolz) so now there's no wifi
also, i tried both the master and rock.new_btcoex, I guess both are unsupported

Last edited by dedpul (2016-07-27 16:05:54)

Offline

#10 2016-08-12 02:04:05

Severus Tux
Banned
Registered: 2016-06-25
Posts: 35

Re: rtl8723be wifi connection issues solved by antenna selection

I get the following error while trying to "make"

[severus@Tux rtlwifi_new]$ make
make -C /lib/modules/4.6.4-1-ARCH/build M=/home/severus/rtlwifi_new modules
make[1]: Entering directory '/usr/lib/modules/4.6.4-1-ARCH/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/4.6.4-1-ARCH/build'
make: *** [Makefile:57: all] Error 2
[severus@Tux rtlwifi_new]$ 

What should I do?

Last edited by Severus Tux (2016-08-12 02:04:23)

Offline

#11 2017-07-20 04:36:50

kstenger
Member
From: Uruguay
Registered: 2011-05-09
Posts: 15

Re: rtl8723be wifi connection issues solved by antenna selection

I came up to this topic, to figure out the latest kernel provides this package out of the box. No need to build it or download it from aur anymore.
The only tweak I had to do as adviced above was to seek for the right parameter value for my anthena (the X value) which in my case is 1 for an Hp ProBook 455 G3.

/etc/modprobe.d/rtl8723be.conf
==============================
options rtl8723be fwlps=N ips=N swlps=N swenc=Y disable_watchdog=1 ant_sel=X

Before setting this values the connection was very unstable, and also the list of wifi connections detected in the area much lower.
I'm not sure what the rest of the parameters do, but obviously there was a significant change.

Thanks to all the developers and testers involved.
*happy customer* :-)

Offline

Board footer

Powered by FluxBB