Wi-Fi instability mitigation

The recent updates of Raspberry Pi OS gave new rise to a well-known issue with the builtin Broadcom Wi-Fi. The power save feature breaks the connection occasionally and Zynthian will not automatically reconnect because it still shows as being connected. This is just massively annoying.
As a workaround, I’ve tried with adding to the file /etc/rc.local these two lines :

iw dev wlan0 set power_save off
iw dev wlan0 set txpower fixed 1000

So the entire file looks like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iw dev wlan0 set power_save off
iw dev wlan0 set txpower fixed 1000
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0

then issued sync and reboot.
Now it looks like the Wi-Fi connection remains more stable and the Zynthian does not disappear from the router any more

Edit: The txpower value of 1000 renders a measured and verified better Wi-Fi signal quality with lesser distortions than the value of 3000. This enhances stability even further. It seems to have a cause in the internal antenna structure having too bad SWR, causing too many reflections. This better signal quality may come at a cost of reduced maximum distance, but allows more thoughput at shorter distance and better stability as well.
To verify, call iwconfig and see the Tx-Power=10 dBm, and Tx excessive retries:0 or a small number is far less than with the setting of 3000.

4 Likes