Unable to create WLAN access point with old firmware
Hi, I'm trying to set up an access point and I must use firmware version 1.20.0.rc11 because I'm using an old LoRa library which only works with this specific version. The LoRa network is up and running, however I am unable to set up a network access point. When I upgrade the firmware to a newer version (any of the latest versions), the access point works but the LoRa does not work (because of old mesh libraries).
The code runs fine and it outputs "Wifi is up", however the network does not appear on my list of networks when I'm using firmware 1.20.0.rc11. If I upgrade the firmware version, it suddenly appears as a network on my laptop. How can I fix this issue and how can I get the access point and LoRa both working at the same time?
Code to setup access point:
from network import WLAN wlan = WLAN() wlan.init(mode=WLAN.AP, ssid="hello", auth=(WLAN.WPA2, "eightletters"), channel=1) print("Wifi is up!")
Link to the LoRa mesh library I am using (which requires firmware 1.20.0.rc11): https://github.com/pmanzoni/pycom_mesh
I have been trying to upgrade and downgrade versions all day, but can't find a version that works with both LoRa and AP.
Does anyone know why I cannot see the network on my laptop? Thanks in advance!
@Sirajuddin-Asjad apparently in recent releases you need to add PyMesh support via PyBytes before you can use it.
See https://docs.pycom.io/pybytes/pymeshintegration/provisioning/ for details.
@jcaron Thanks for your reply!
The code examples from GitHub are verified and tested on firmware 1.20.0.rc11 (this is a legacy version). I have tested the code examples on many different firmware versions and the results are similar.
Running the code on a more recent version (1.20.2.r4):
Results: WLAN.AP works, LoRA does not work.
Comment: The WLAN access point is enabled and appears as a network on my laptop. LoRa crashes and does not start.
rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8020,len:8 load:0x3fff8028,len:2128 load:0x4009fa00,len:19760 entry 0x400a05bc Enabling WiFi... Enabling Lora... LoRa MAC: 70b3d54991d40180 Traceback (most recent call last): File "main.py", line 320, in <module> File "/flash/lib/lorameshlib.py", line 46, in __init__ AttributeError: 'LoRa' object has no attribute 'Mesh' Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; LoPy4 with ESP32 Type "help()" for more information. >>>
Running the same code on firmware version 1.20.0.rc11:
Results: LoRA works, WLAN.AP does not work.
Comment: The LoRa mesh network starts and works as expected, but the WLAN access point does not appear on my list of networks and I'm unable to find it on my laptop. It does not work properly, even though it says "Enabling WiFi" in the output results.
rst:0x1 (POWERON_RESET),boot:0x1a (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8028,len:8 load:0x3fff8030,len:2156 ho 0 tail 12 room 4 load:0x4009fa00,len:19208 entry 0x400a05f4 Initializing filesystem as FatFS! Enabling WiFi... Enabling Lora... LoRa MAC: 70b3d54991d40180 2: PYMESH_ROLE_DETACHED ... waiting. 4: PYMESH_ROLE_DETACHED ... waiting. 6: PYMESH_ROLE_DETACHED ... waiting. 8: PYMESH_ROLE_DETACHED ... waiting. 10: PYMESH_ROLE_DETACHED ... waiting. 12: PYMESH_ROLE_DETACHED ... waiting. 14: PYMESH_ROLE_DETACHED ... waiting. 16: PYMESH_ROLE_DETACHED ... waiting. 18: PYMESH_ROLE_DETACHED ... waiting. 20: PYMESH_ROLE_DETACHED ... waiting. 22: PYMESH_ROLE_DETACHED ... waiting. 24: connected as PYMESH_ROLE_LEADER. IP: fdde:ad00:beef:0:d06:83c1:e0f0:78bc opened: 0x3f952260
I'm trying to find out why the WLAN access point stops working on firmware 1.20.0.rc11 and why it does not appear as a connectable network on my laptop.
I'm force-erasing the LoPy4 whenever I upgrade or downgrade firmware versions, so that means any Pybytes configuration should be deleted every time I change versions. Unless there is any manual configuration required to disable Pybytes, however that would not explain why the WLAN works on the latest firmware version but not the old legacy version.
I hope the information provided is helpful, and thanks a lot in advance!
@Sirajuddin-Asjad the link you included is not for a mesh library (which is built into the LoPy firmware if you pick the right version), those are just examples. They should work on any version of the library with mesh support.
What happens when you use a more recent version (please include full logs of the output)?
Also, you may want to make sure Pybytes is disabled, as it tries to do a lot of things behind the scenes both with WiFi and LoRa, so it can lead to confusing results.