Hi, I’m trying to create an Access Point using Arduino Portenta H7 Lite Connected but it doesn’t work. My code is:
ap = network.WLAN(AP_IF)
ap.config(essid=‘MySSID’, password=‘MyPassword’, authmode=3)
while ap.active() == False:
ap.ifconfig((‘192.168.50.1’, ‘255.255.255.0’, ‘0.0.0.0’, ‘220.127.116.11’))
In the first place it doesn’t recognize the parameter “authmode” but even if I remove it I’m facing troubles with connecting my Laptop to this network. If I try to use my smartphone it seems that it fails to obtain the IP address.
I’m running following version of Micropython:
MicroPython: v1.18-omv-r6 OpenMV: v4.3.1 HAL: v1.9.0 BOARD: PORTENTA-STM32H747
Would you advice how to address this issue?
This works fine, and I can connect to it:
import time, network, socket, sys
SSID ='OPENMV_AP' # Network SSID
KEY ='1234567890' # Network key (must be 10 chars)
HOST = '' # Use first available interface
PORT = 8080 # Arbitrary non-privileged port
# Init wlan module in AP mode.
wlan = network.WLAN(network.AP_IF)
wlan.config(essid=SSID, channel=11, password=KEY)
print("Connect to: ", wlan.ifconfig())
while (len(wlan.status("stations")) == 0):
print("Waiting for a station to connect...")
print("Station connected", ':'.join(["%x"%(x) for x in wlan.status("stations")]))
Hi, Thanks a lot! At least I can connect and start developing the data transmission algorithm. The "while " loop that waits for a station to be connected let me connect to the Access Point generated with my Portenta board.
Nevertheless, I have to use it within a factory environment so I also have to provide some basic security. Despite your code includes the KEY the WiFi network is still open. My laptop and smartphone newer prompt me to enter a password. The authmode parameter is still unknown for the wlan.config() method. I wanted to put there 3 for WPA2-PSK encryption.
The other issue is that the DHCP server always assigns an IP address in range of 192.168.4.XXX even if I set the Access Point address to using the code “wlan.ifconfig((‘192.168.5.1’, ‘255.255.255.0’, ‘192.168.5.1’, ‘18.104.22.168’))”
Is there a workaround to address these 2 issues?
Our driver and modules are outdated, authentication was not working at that time, and it will need a driver update and that will take a while, also FYI
authmode was deprecated and has been replaced with
security. You can switch to using micropython nightly builds, it should have security arg working, if you need this working right now and don’t need OpenMV, or you can wait. You’ll find the firmware here:
The other issue is that the DHCP server always assigns an IP address in range of 192.168.4.XXX even if I set the Access Point address to using the code
If you can reproduce that issue with micropython nightly builds above, then please report it to micropython, if not, then it will be fixed when the driver is updated.
I need the ‘pyb’ module so I’ll probably have to wait for the OpenMV firmware. Nevertheless, I’ll give it a try and test the WLAN and usocket data transfer only as soon as I have a little time to do that.
Today I had another issue. I wanted to do the socket.bind() and socket.listen on the Portenta but it got stuck. So I ended up using socket.connect() as a socket client.