Join GitHub today
WIFI antenna selection not working #206
I am testing WIFI signal strength with external antenna on WiPy 3 with latest FW (1.18.1.r1). I am using this antenna: https://pycom.io/product/external-wifi-antenna/
I scan for networks with this code:
from network import WLAN
I usually see rssi-values in the range -65 - -70, the same when I use the internal antenna. When I put my thumb over the integrated antenna rssi goes to appr. -85. This makes me belive that this antenna is in use.
Adding this code makes the board behave as expected.
from machine import Pin
Looks like the bug is in esp32/util/antenna.c. For the "new" boards, the pin is not initialized as output, and the command to select the antenna just writes the value to the output register, without then changing the actual output level.
There is code to init P12 as output (that was missing) both in the actual master branch and in the release-candidate branch. It is used when the external antenna is selected.