Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIFI antenna selection not working #206

Closed
johandse opened this Issue Sep 12, 2018 · 5 comments

Comments

Projects
None yet
6 participants
@johandse
Copy link
Contributor

johandse commented Sep 12, 2018

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
wlan = WLAN(mode=WLAN.STA)
wlan.antenna(WLAN.EXT_ANT)
nets = wlan.scan()
for net in nets:
print(net)

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
p_out = Pin('P12', mode=Pin.OUT)
p_out.value(1)

@dmartauz

This comment has been minimized.

Copy link

dmartauz commented Sep 12, 2018

I can confirm same behaviour with LoPy4 running FW 1.18.1.r1. Difference in RSSI in my case is more than 20dB because the module (and its integrated antenna) is enclosed in aluminium housing.

@robert-hh

This comment has been minimized.

Copy link
Contributor

robert-hh commented Sep 12, 2018

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.
Edit: As a proof: it is sufficient to define P12 as output. Then wlan.antenna() works.

@sdaniel55 sdaniel55 added the bug label Nov 2, 2018

@sdaniel55

This comment has been minimized.

Copy link

sdaniel55 commented Nov 2, 2018

Hi everyone 👋

Just a quick update on this issue: it has been resolved and will be released in the next firmware cycle. I'll keep this issue open until it's published.

@Jollyjohn

This comment has been minimized.

Copy link

Jollyjohn commented Jan 13, 2019

@sdaniel55 Hi Daniel - this bug was raised against 1.18.1.r1 and since then we have had r3, r4 and r7. Is the fix in production now, or is it waiting for a change in the lowest dot.level? (e.g. 1.18.2)

@robert-hh

This comment has been minimized.

Copy link
Contributor

robert-hh commented Jan 13, 2019

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.
Edit: i checked that when selecting external antenna, the level at P12 changes to 3.3V (high).
Tested with v1.20.0.rc4.

@iwahdan88 iwahdan88 closed this Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.