Realiable WiFi on PYBD

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
agners
Posts: 2
Joined: Thu Jul 25, 2019 9:48 pm

Realiable WiFi on PYBD

Post by agners » Thu Jul 25, 2019 10:01 pm

Hi MicroPython community,

First, thanks for making something awesome as MicroPython happen! It really makes my software engineer heart really warm and cozy!

I use my SF2W since some weeks to log data to a MQTT server. This works nice and rather reliably. However, when my WiFi disappears my Python script gets stuck and remains so after connecting. I tried to make it more reliable, but was not really able to.

I tried with something like this in my main loop:

Code: Select all

    if not wl.isconnected():
        errled.on()
        wl.disconnect()
        wl.connect(...)
        while not wl.isconnected():
            time.sleep_ms(200)
However, from what I can see wl.isconnected() never gets True in those situation.

Enabling traceing seems to indicate that the lower layer connects, but it seems not to be reflected on the Python API:

Code: Select all

[  884015] ASYNC(0000,32,0,0,0)
[  884018] ASYNC(0000,ASSOC_REQ_IE,0,0,0)
[  884018] ASYNC(0000,AUTH,0,0,0)
[  884040] ASYNC(0000,ASSOC_RESP_IE,0,0,0)
[  884040] ASYNC(0000,9,0,0,0)
[  884040] ASYNC(0001,LINK,0,0,0)
[  884049] ASYNC(0000,PSK_SUP,6,0,0)
[  884114] ASYNC(0000,JOIN,0,0,0)
[  884115] ASYNC(0000,125,0,0,0)

>>> wl.status()
-2
>>> wl.isconnected()
False
I also found this which claims that PYBD should automatically reconnect:
https://github.com/peterhinch/micropyth ... /pyboard_d

This seems not true/have issues?

Banner says I am using:
MicroPython v1.10-445-ga9b1d3ca3 on 2019-05-29; PYBD_SF2W with STM32F722IEK

Which I think is the latest version? (at least banner did not change after reflashing some minutes ago. But *please* add version information to the PYBD builds in your downloads section...)

Best regards,
Stefan

User avatar
jimmo
Posts: 640
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Realiable WiFi on PYBD

Post by jimmo » Mon Jul 29, 2019 1:31 am

Hi,

Thanks for the report -- it does look like there are still some issues to work out here. https://github.com/micropython/micropyt ... -515534326 is tracking some of the history.

There were some fixes recentlyish but it sounds like it's possible that the version you're running might be slightly out of date.
agners wrote:
Thu Jul 25, 2019 10:01 pm
Banner says I am using:
MicroPython v1.10-445-ga9b1d3ca3 on 2019-05-29; PYBD_SF2W with STM32F722IEK

Which I think is the latest version? (at least banner did not change after reflashing some minutes ago. But *please* add version information to the PYBD builds in your downloads section...)
I think the download page hasn't been updated since pybd support was fully merged into the master branch. These were manual builds that were made when the pybd started shipping I think. If you're able to build your own firmware from master that might be worth trying, otherwise I can send you a .dfu file.

I'll find out about getting the downloads page updated to track pybd versions in the same way as other boards.

Post Reply