Hi everyone,
I’m struggling with unreliable WiFi connections on my Portenta H7 when connecting to an access point with VLANs.
Symptoms:
ScanNetworksAdvancedlists all networks correctly, including the VLAN SSID.- When I run
WiFiWebClient, it almost never connects. - First connection attempt: takes ~1 minute, then returns 4 (no connection).
- Following attempts: fail faster (~5 seconds).
- When it does connect, the link is stable (I can run Modbus and a test web server reliably).
Setup:
- Access point with VLAN, using WPA2 encryption.
- Firewall in between, currently configured to accept all traffic (to allow Modbus now, and later a web interface).
- Other devices (laptops, phones, ESP32) connect to the same SSID without issue.
- Verified VLAN + DHCP settings, tried testing close to the AP.
Notes:
- The firewall doesn’t seem to be blocking anything — once connected, traffic flows fine.
- Connection issues have existed since the start of the project.
Questions:
- Is there a known problem with the Portenta H7 and VLAN-tagged SSIDs on WPA2?
- Any debugging tips to better understand why the first association fails so often?
Thanks in advance for any advice — I’d love to hear if anyone else has run into this.
Here's a minimal sketch which makes problems appear as described:
#include <WiFi.h>
char ssid[] = "MySSID";
char pass[] = "MyPassword";
void setup()
{
Serial.begin(9600);
while (!Serial);
WiFi.disconnect();
delay(2000);
int maxTries = 5;
int attempt = 0;
Serial.println("Trying to connect...");
while (WiFi.status() != WL_CONNECTED && attempt < maxTries)
{
Serial.println(WiFi.begin(ssid, pass));
attempt++;
}
if (WiFi.status() == WL_CONNECTED)
{
Serial.println("Connected!");
Serial.print("IP-Addr: ");
Serial.println(WiFi.localIP());
}
else Serial.println("\nWifi Connection Failed!");
}
void loop()
{
}