ODIN-W2 hardfaults trying to connect to enterprise WiFi network (PEAP)

Hello, my EVK-ODIN-W2 (Mbed OS v5.13.2) hardfaults when it tries to connect to an enterprise WiFi network using PEAP. I can confirm that I could connect an iPhone to the network with the provided credentials and PEAP user/password, so I don’t think this is an issue with the network itself. This is the error log that appears after calling wifi->connect() in my code:

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0 : 44E13C4B
R1 : 00000020
R2 : 00000000
R3 : 2001240C
R4 : 44E13C4B
R5 : 00000000
R6 : 44E13B7F
R7 : 20014740
R8 : 00000000
R9 : 20015532
R10 : 20014724
R11 : FFFFD800
R12 : 08029E91
SP : 20010AA8
LR : 0802313B
PC : 0802018E
xPSR : 21000000
PSP : 20010A88
MSP : 2002FFC0
CPUID: 410FC241
HFSR : 40000000
MMFSR: 00000000
BFSR : 00000082
UFSR : 00000000
DFSR : 00000008
AFSR : 00000000
BFAR : 44E13C4B
Mode : Thread
Priv : Privileged
Stack: PSP

– MbedOS Fault Handler –

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x80163A5
Error Value: 0x802018E
Current Thread: application_unnamed_thread Id: 0x20010118 Entry: 0x800D5D1 StackSize: 0x1000 StackMem: 0x20010168 SP: 0x2002FF18
For more info, visit: mbedos-error
– MbedOS Error Info –

= System will be rebooted due to a fatal error =
= Reboot count(=1) reached maximum, system will halt after rebooting =

I tried searching for details on error 0x80FF013D but found nothing. What could be causing the fatal crash?

Hi Manuel,

Are you using our provided wifi example? It looks like some configuration not set correctly. If you can share you code snippet and mbed_app.json, it would be helpful for addressing the issue.

Also you can refer to the PR 10454, there are some release notes for using PEAP.

Let me know if you have further questions.

Regards,
Desmond

Hi Desmond,

Thanks for reaching out. My code is a slightly modified version of “mbed-os-example-wifi”.

Here is my main.cpp

#include "mbed.h"
#include "OdinWiFiInterface.h"

OdinWiFiInterface *wifi;

static auth_cert_s certificates;

int main()
{
    printf("WiFi example\n");

    wifi = new OdinWiFiInterface();
    if (!wifi) {
        printf("ERROR: No WiFiInterface found.\n");
        return -1;
    }

    printf("\nConnecting to network\n");
    // network has no password
    int ret = wifi->connect(SSID, NULL, NSAPI_SECURITY_PEAP, &certificates, PEAP_USER, PEAP_PASSWORD, 0);
    if (ret != 0) {
        printf("\nConnection error: %d\n", ret);
        return -1;
    }

    printf("Success\n\n");
    printf("MAC: %s\n", wifi->get_mac_address());
    printf("IP: %s\n", wifi->get_ip_address());
    printf("Netmask: %s\n", wifi->get_netmask());
    printf("Gateway: %s\n", wifi->get_gateway());
    printf("RSSI: %d\n\n", wifi->get_rssi());
    printf("\nDone\n");
}

This is my mbed_app.json file:

{
    "config": {
        "wifi-ssid": {
            "help": "WiFi SSID",
            "value": "\"SSID\""
        },
        "wifi-password": {
            "help": "WiFi Password",
            "value": "\"PASSWORD\""
        }
    },
    "target_overrides": {
        "*": {
            "platform.stdio-convert-newlines": true
        }
    }
}

I did take a look at PR 10454 and as far as I can tell I followed all instructions but for some reason the ODIN always crashes. However, the same code will work fine if I try to connect to a WPA2 Personal network, it only fails if I try to connect to an Enterprise network.

Thanks a lot for your help, I really appreciate it.

Regards,
Manuel

Hi,

PEAP username and password is not defined in your mbed_app. You need to add following in your mbed_app.json, ofcourse replacing the values in each variable as per your own details:

{
    "config":
        "wifi-ssid_8021x": {
            "help": "EAP SSID",
            "value": "\"your-peap-ap-name\""
        },
        "peap_username": {
            "help": "PEAP Username",
            "value": "\"your-peap-username\""
        },
        "peap_password": {
            "help": "PEAP Password",
            "value": "\"your-peap-password\""
        },
        "wifi-password_8021x": {
            "help": "EAP PASS",
            "value": "\"your-peap-password\""
        }
    },
    "target_overrides": {
       "*": {
          "target.network-default-interface-type": "WIFI",
          "platform.stdio-convert-newlines": true
       }
   }
}

Then use following main.cpp to connect to PEAP AP:

#include "mbed.h"
#include "OdinWiFiInterface.h"

#define DEFAULT_WIFI_CONN_CHANNEL     0

OdinWiFiInterface *wifi;

static const char *_ap_ssid_8021x = MBED_CONF_APP_WIFI_SSID_8021X;
static const char *_ap_pass_8021x = MBED_CONF_APP_WIFI_PASSWORD_8021X;
static const char *_peap_username = MBED_CONF_APP_PEAP_USERNAME;
static const char *_peap_user_pass = MBED_CONF_APP_PEAP_PASSWORD;

int main()
{
    int result;
    printf("WiFi example: Connecting to WiFi AP using PEAP\n");

    wifi = new OdinWiFiInterface(true);
    result = wifi->set_dhcp(true);

    if (!wifi) {
        printf("ERROR: No WiFiInterface found.\n");
        return -1;
    }

    auth_cert_s s_certificates;
    s_certificates.client_cert = NULL;
    s_certificates.client_prvt_key = NULL;
    s_certificates.ca_cert = NULL; // If your PEAP AP uses CA cert, place it in the char array and reference it here as &ca_cert_data[0]

    printf("Connecting to network\n");
    result = wifi->connect(_ap_ssid_8021x, _ap_pass_8021x , NSAPI_SECURITY_PEAP, s_certificates, _peap_username, _peap_user_pass, DEFAULT_WIFI_CONN_CHANNEL);

    if (result != NSAPI_ERROR_OK) {
        printf("\nConnection error: %d\n",  result );
        return -1;
    }

    printf("Success\n\n");
    printf("MAC: %s\n", wifi->get_mac_address());
    printf("IP: %s\n", wifi->get_ip_address());
    printf("Netmask: %s\n", wifi->get_netmask());
    printf("Gateway: %s\n", wifi->get_gateway());
    printf("RSSI: %d\n\n", wifi->get_rssi());
    printf("\nDone\n");
}
1 Like