Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

WIFI antenna selection not working #206

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

WIFI antenna selection not working #206

johandse opened this issue Sep 12, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@johandse
Copy link

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
Copy link

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
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.

@danspndl danspndl added the bug Something isn't working label Nov 2, 2018
@danspndl
Copy link

danspndl 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
Copy link

@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
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.

peter-pycom pushed a commit that referenced this issue Jan 12, 2021
* fixed setting time in rtc
* do not reset the time on init
X-Ryl669 pushed a commit to X-Ryl669/pycom-micropython-sigfox that referenced this issue May 12, 2023
* fixed setting time in rtc
* do not reset the time on init
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants