I’m using portenta H7 and trying to run the example ‘connect.py’ code
However i’m always met with the timeout error. But when i run the ‘scan.py’ it correctly identifies the existing networks. I am running it in office and device has been whitelisted but could this be due to some office firewall?
I’ve followed the steps here WiFi broken on Portenta - #4 by pilot and have it updated to the 4.3.2 (4.3.1 previously didn’t work); however it works and connects well on my personal hotspot
I’m not sure if you’re saying it’s connecting to the AP and times out on socket connect or doesn’t connect at all to the AP. Either way, it seems it has something to do with the AP in your office.
the device is ‘approved’ to connect to office wifi.
I’ve tried connecting from my hotspot and it works well. The scan wifi code runs and it is able to detect the office wifi too
Update: I’ve been playing around and tried putting it in a try-except block
wlan.active(True)
try:
wlan.connect(SSID, PASSWORD, timeout=20000)
except OSError:
print("Error connecting: "+str(wlan.status()))
# We should have a valid IP now via DHCP
print("WiFi Connected ", wlan.ifconfig())
Now the except block throws up the error but then the wifi gets connected (although there does not seem to be any internet connectivity as when i try to paste this connect code into my own code, it does not execute the commands to retrieve the details) and i get this in the serial terminal
>>> Trying to connect. Note this may take a while...
Error connecting: -2
WiFi Connected ('the ipconfig for the wifi')
MicroPython: 7009f24 OpenMV: 88f7687 HAL: v1.9.0 BOARD: PORTENTA-
STM32H747
Type "help()" for more information.
>>>
In addition, when i put it in my code as part of the process to connect to wifi it returns as
Error connecting: 1
AttributeError: 'NoneType' object has no attribute 'ifconfig'
Oh yes you are right. I forgot to check for that. Previously i was using Arduino IDE and could connect so it slipped my mind that the module here would be 2.4GHz. OpenMV +micropython allowed us to do more blob detection
Thanks for the help! Will try to find a temporary workaround for it