Description
When I configure Ethernet for my ESP32 board (a new wESP32 revision) and flash the generated image, I get this output:
[Aug 5 11:51:07.186] mgos_freertos.c:155 mongoose-app1 1.0 (20210805-171245)
[Aug 5 11:51:07.191] mgos_freertos.c:157 Mongoose OS 202107262051 (20210805-171245/2.19.1-42-ga0be0b3e-master)
[Aug 5 11:51:07.196] mgos_freertos.c:161 CPU: 160 MHz, FreeRTOS 8.2.0, heap: 243628 total, 211228 free
[Aug 5 11:51:07.202] mgos_freertos.c:163 Newlib 3.0.0
[Aug 5 11:51:07.207] esp32_main.c:65 ESP-IDF 4.2-r1
[Aug 5 11:51:07.214] esp32_main.c:68 Boot partition: app_0; flash: 16M
[Aug 5 11:51:07.214] mongoose.c:15754 Mongoose 6.18, LwIP 2.1.3
[Aug 5 11:51:07.219] mongoose.c:4932 mbed TLS 2.16.6-cesanta1
[Aug 5 11:51:07.226] mgos_vfs_dev.c:73 fs_0: esp32part ({"label": "fs_0"}), size 262144
[Aug 5 11:51:07.232] mgos_vfs_dev.c:73 fs_1: esp32part ({"label": "fs_1"}), size 262144
[Aug 5 11:51:07.238] mgos_vfs.c:174 /: SPIFFS @ fs_0, opts {"bs":4096,"ps":256,"es":4096}
[Aug 5 11:51:07.732] mgos_vfs.c:347 /: size 233681, used: 128010, free: 105671
[Aug 5 11:51:08.030] mgos_sys_config.c:232 Loading conf9.json
[Aug 5 11:51:08.040] mgos_sys_config.c:368 MAC: a8:03:2a:f3:6c:e8
[Aug 5 11:51:08.040] mgos_sys_config.c:376 WDT: 30 seconds
[Aug 5 11:51:08.046] �[0;32mI (900) BTDM_INIT: BT controller compile version [3723d5b]�[0m
[Aug 5 11:51:08.149] �[0;32mI (1000) phy: phy_version: 4500, 0cd6843, Sep 17 2020, 15:37:07, 0, 0�[0m
[Aug 5 11:51:08.155] Coex register schm btdm cb faild
[Aug 5 11:51:08.481] esp32_bt.c:171 Bluetooth init ok, MTU 500, pairing enabled, 0 paired devices
[Aug 5 11:51:08.488] mgos_ota_shadow_lib:116 OTA over shadow initialised
[Aug 5 11:51:08.497] esp32_bt_gatts.c:841 Starting BT service 5f6d4f53-5f44-4247-5f53-56435f49445f
[Aug 5 11:51:08.529] �[0;32mI (1380) esp_eth.netif.glue: a8:03:2a:f3:6c:eb�[0m
[Aug 5 11:51:08.529] �[0;32mI (1390) esp_eth.netif.glue: ethernet attached to netif�[0m
[Aug 5 11:51:08.535] esp32_eth.c:161 ETH: MAC a8:03:2a:f3:6c:eb; PHY: RTL8201 @ 1; IP: DHCP
[Aug 5 11:51:08.570] mgos_wifi.c:332 WiFi mode: off
[Aug 5 11:51:08.570] mgos_http_server.c:377 HTTP server started on [80]
[Aug 5 11:51:08.577] mgos_dash.c:203 Dash init ok, server: wss://mdash.net/api/v2/rpc)
[Aug 5 11:51:08.583] mgos_provision_stat:120 Max state: 0
[Aug 5 11:51:08.592] mgos_rpc_channel_mq:218 0x3ffde040 esp32_F36CE8/rpc
[Aug 5 11:51:08.592] �mgos_rpc_channel_ua:313 0x3ffde534 UART0
[Aug 5 11:51:08.599] mgos_init.c:36 Init done, RAM: 257236 total, 134204 free, 134204 min free
[Aug 5 11:51:09.180] at init.js:26
[Aug 5 11:51:09.180] MJS error: failed to call FFIed function: actual arg #0 is not an int (the type idx is: undefined)
[Aug 5 11:51:09.206] esp32_bt_gap.c:102 BT device name esp32_F36CE8, addr a8:03:2a:f3:6c:ea,1 err 0
[Aug 5 11:51:09.212] mgos_mongoose.c:66 New heap free LWM: 107644
[Aug 5 11:51:09.218] mgos_ota_core.c:1335 UID: 0fb485ce3c115a9f, license: none
[Aug 5 11:51:14.564] mgos_net.c:90 ETH: connected
As you can see, it has the correct PHY and finds the MAC, says Ethernet is connected to netif, then on the last line it reports Ethernet is connected so it can obviously communicate with the PHY. But nothing happens after this. Apparently no DHCP request is done to try to get connected to the network, the device doesn't show up in mDash either.
Now when I try the exact same thing with WiFi, after setting the credentials the system gets an IP address over DHCP, it connects to mDash, it's all taken care of automatically. Why the difference in behavior? Shouldn't Ethernet work the same?
If you compare the WiFi and Ethernet docs, there are a ton of network related things that can be configured in WiFi but not in Ethernet. I also can't seem to find any docs on how to try and get connected to the network manually with Ethernet (like how do you enable the DHCP client manually since it doesn't seem to work automatically). How is a person supposed to actually use the Ethernet?
My config contains the following:
author: mongoose-os
description: A JS-enabled demo Mongoose OS firmware
platform: esp32
# arch: PLATFORM
version: 1.0
manifest_version: 2017-05-18
libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}
config_schema:
- ["mqtt.server", "iot.eclipse.org:1883"]
- ["i2c.enable", true]
tags:
- js
filesystem:
- fs
config_schema:
- ["eth.clk_mode", 0]
- ["eth.mdc_gpio", 16]
- ["eth.mdio_gpio", 17]
- ["eth.phy_addr", 1]
- ["eth.enable", true]
libs:
- location: https://github.com/mongoose-os-libs/ethernet
- location: https://github.com/mongoose-os-libs/js-demo-bundle
conds:
- when: mos.platform == "esp32"
apply:
cdefs:
MGOS_ETH_PHY_LAN87x0: 0
MGOS_ETH_PHY_RTL8201: 1
build_vars:
# Icrease app szie for ESP32
APP_SLOT_SIZE: 0x190000