I suppose you are using Raspbian. With my RasPis I have found that they tend to connect first to the 2.4 GHz band if both bands available. So first you should check if the 5 GHz band is seen by your RasPi. Execute this command.
rpi ~$ sudo iw wlan0 scan | grep -A5 'freq: 5'
It should give you at least one (ore more) outputs like this:
freq: 5300
beacon interval: 100 TUs
capability: ESS Privacy SpectrumMgmt ShortSlotTime RadioMeasure (0x1511)
signal: -71.00 dBm
last seen: 0 ms ago
SSID: RPiNet
If you find one then you can restrict wpa_supplicant only to connect with this frequency. Just add a line freq_list= to /etc/wpa_supplicant/wpa_supplicant.conf. According to the documentation in /usr/share/doc/wpa_supplicant/examples/wpa_supplicant.conf you can set it general or within a network block:
# freq_list: Array of allowed frequencies
# Space-separated list of frequencies in MHz to allow for selecting the BSS. If
# set, scan results that do not match any of the specified frequencies are not
# considered when selecting a BSS.
#
# This can also be set on the outside of the network block. In this case,
# it limits the frequencies that will be scanned.
This is an example for a general setting (use your settings for country, ssid and psk). You may consider to move the freq_list inside the network block:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE
freq_list=5300
# freq_list=2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
# freq_list=5170 5180 5190 5200 5210 5220 5230 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700
network={
ssid="RPiNet"
psk="verySecretPassword"
key_mgmt=WPA-PSK
mode=RSN WPA
}
I have commented a complete list of frequencies so you can select what frequencies you want to connect to.
/etc/wpa_supplicant/wpa_supplicant.confonfreq_list=. For example:freq_list=2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 5170 5180 5190 5200 5210 5220 5230 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700– M. Rostami Jan 30 '20 at 10:26freq_list= 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 5180 5200 5220 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700 5720 5745 5765 5785 5805 5825– Allexj Oct 31 '23 at 21:14