jeronimoagullo / Zephyr-WIFI-app-test

This project serves as a simple demonstration of WiFi connectivity using Zephyr RTOS.
1 stars 0 forks source link

Getting error with ESP32S3 module. #1

Open SanjayEIC opened 3 months ago

SanjayEIC commented 3 months ago

Hi, This code looks like up in station mode, so I changed two files rename overlay & .conf in boards getting this type of error.

can you help me for, why geeting this error [00:00:00.355,000] jero_wifi: Connection failed

Wifi_Log
jeronimoagullo commented 3 months ago

Hi @SanjayEIC

It can be different reasons, so I need a bit more info to figure out the root of the failure.

Best Regards

SanjayEIC commented 3 months ago

Hi @jeronimoagullo Thanks for Reply

1) Which board are you using? Is it an esp32s3 or another esp32 board?

2) Which is the content of your new overlay files?

&wifi {
status = "okay";

};

3) Did you specify the SSID and password of your WIFI network?

jeronimoagullo commented 2 months ago

Hi @SanjayEIC

Sorry for the delay, but I couldn't check it out before. I found the issue, I will explain it and do a pull request to fix it.

The issue is related to the initialization of the network interface in the ESP32 families. The Net if is not up at boot, then I added the following line to wait until it is initialized. If you change CONFIG_BOARD_ESP32_DEVKITC_WROVER to your board or directly to the whole ESP32 family CONFIG_SOC_FAMILY_ESP32, it would work:

#ifdef CONFIG_BOARD_ESP32_DEVKITC_WROVER
    uint32_t raised_event;
    const void *info;
    size_t info_len;

    LOG_INF("Waiting for net if being up");
    int ret = net_mgmt_event_wait_on_iface(net_if_get_default(),
                       NET_EVENT_IF_UP, &raised_event, &info,
                       &info_len, K_SECONDS(60));

    if (ret != 0) {
        LOG_ERR("Timeout: Net if cannot bring up");
        return false;
    } else {
        LOG_INF("Net if is up");
    }
    #endif

However, there is a better approach. We can check wether the net if is up with the function net_if_flag_is_set(iface, NET_IF_UP) and wait for it only if it is down.

I will change it and make a new commit. Let me know if it fixes your issue :D