Connecting to WIFI: Guru Meditation Error
i am currently trying to connect to a WPA2-Enterprise (eduroam) network as described here on a Lopy4 with Pysense Expansion board.
This is my
main.pyfile (no other files are used in this project):
from network import WLAN from machine import SD import os import time sd = SD() os.mount(sd, '/sd') wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: print(net.ssid) print(net.channel) if net.ssid == "eduroam" and wlan.channel() == net.channel: print('Wifi found. connecting.') wlan.connect(ssid='eduroam', auth=(WLAN.WPA2_ENT, '[username]', '[pw]'), identity='[identy]', ca_certs='/sd/cert/ca.pem') break
The device boots up and runs the script without error. However
wlan.isconnected()will always return
Then, after a couple of seconds the device crashes with the error message:
>>> Guru Meditation Error: Core 0 panic'ed (LoadProhibited) . Exception was unhandled. Register dump: PC : 0x40188721 PS : 0x00060630 A0 : 0x801832fa A1 : 0x3ffe39f0 A2 : 0x3ffe3f9c A3 : 0x00000001 A4 : 0x3fbc64a4 A5 : 0x00000001 A6 : 0x3ffe3ac4 A7 : 0x00000001 A8 : 0x8018871d A9 : 0x3ffe4988 A10 : 0x00000000 A11 : 0x000000ff A12 : 0x3ffe3f9c A13 : 0x00000000 A14 : 0x00000002 A15 : 0x00000005 SAR : 0x00000018 EXCCAUSE: 0x0000001c EXCVADDR: 0x00000001 LBEG : 0x40187509 LEND : 0x4018750f LCOUNT : 0x00000000
After a long sequence of printed core dumping the system will restart.
The device is apparently setting up the connection in the background and will at some point fail. I investigated the Guru Meditation error (details here) and found that:
This CPU exception happens when application attempts to read from or write to an invalid memory location. The address which was written/read is found in EXCVADDR register in the register dump. If this address is zero, it usually means that application attempted to dereference a NULL pointer. If this address is close to zero, it usually means that application attempted to access member of a structure, but the pointer to the structure was NULL. If this address is something else (garbage value, not in 0x3fxxxxxx - 0x6xxxxxxx range), it likely means that the pointer used to access the data was either not initialized or was corrupted.
So apparently the application attempted to access member of a structure, but the pointer to the structure was NULL. That doesn't really help me, however.
Is anybody facing the same problem or has some advice?
Notes on the code:
I am checking
wlan.channel()==net.channel()as eduroam is available at least twice on different channels. The Lopy4 is set on channel 6 and I also find on instance of eduroam on this channel. I don't know if that is important as my problem persists and I can't connect to WIFI either way.
ca.pemfile that I have stored on SD is the same that I am using on my Ubuntu Laptop to (successfully) connect to eduroam.