Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

Network configuration via Bluetooth RPC call – enable DHCP

We want to configure the network interfaces of our board via bluettooth.

We access the configuration parameters as described in the following blog.
https://mongoose-os.com/blog/bluetooth-support-for-esp32/

Setting a network interface (wifi station mode or ethernet node) to DHCP to retrieve network parameter as client requires to reset certain network parameters.
Therefor we want to set the following configuration parameters to an empty string.

["eth.ip", "s", {title: "Static IP Address"}]
["eth.netmask", "s", {title: "Static Netmask"}]
["eth.gw", "s", {title: "Static Default Gateway"}]
["wifi.sta.ip", "s", {title: "Static IP Address"}]
["wifi.sta.netmask", "s", {title: "Static Netmask"}]
["wifi.sta.gw", "s", {title: "Static Default Gateway"}]

Changing the configuration parameters to an empty string via Bluetooth RPC causes a exception. Empty strings are NULLs and it causes a NULL dereference.

Which values needs to be set to change from a fixed IP address configuration to DHCP?
How can the values for these parameters set via bluetooth?

We get the following error when we set an empty string to a configuration parameter:

[Jan 29 16:55:03.572] mgos_bt_svc_config_s ‘wifi.sta.ssid’ = ‘SMAG’
[Jan 29 16:55:04.130] Guru Meditation Error: Core 0 panic’ed (LoadProhibited)
[Jan 29 16:55:04.130] . Exception was unhandled.
[Jan 29 16:55:04.130] Register dump:
[Jan 29 16:55:04.130] PC : 0x400014fd PS : 0x00060530 A0 : 0x801172dc A1 : 0x3ffe1cf0
[Jan 29 16:55:04.130] A2 : 0x00000000 A3 : 0xfffffffc A4 : 0x000000ff A5 : 0x0000ff00
[Jan 29 16:55:04.153] A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffe1ca0
[Jan 29 16:55:04.153] A10 : 0x00000000 A11 : 0x3ffdfd61 A12 : 0x3ffe1f34 A13 : 0x3ffd851c
[Jan 29 16:55:04.153] A14 : 0x00000000 A15 : 0x00000001 SAR : 0x0000001f EXCCAUSE: 0x0000001c
[Jan 29 16:55:04.175] EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
[Jan 29 16:55:04.175]
[Jan 29 16:55:04.175] Backtrace: 0x400014fd 0x401172d9 0x40118a06 0x40128319 0x401327c2 0x40131737 0x40127be5
[Jan 29 16:55:04.175] --- BEGIN CORE DUMP ---
[Jan 29 16:55:04.175] {“arch”: “ESP32", “cause”:28,
[Jan 29 16:55:04.197] “REGS”: {“addr”: 1073543572, “data”: ”
[Jan 29 16:55:04.197] /RQAQNxyEYDwHP4/AAAAAPz/////AAAAAP8AAAAA/wAAAAD/AAAAAKAc/j8AAAAAYf39PzQf/j8chf0/AAAAAAEAAADvvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd7vvq3e776t3u++rd79FABADRUAQP////8fAAAAAAAAAAEAAADvvq3e776t3iAFBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”},
[Jan 29 16:55:04.242] “DRAM”: {“addr”: 1073405952, “data”: ”
[Jan 29 16:55:04.242] AftdgAiRTQsx/kxO4KlRBAAAAACAOQhAAAAAAAAAAADEE/w/xBP8PwAAAAAAAAAAqcT5P6nE+T8BAAAAAAAAAEoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKAAAA
[Jan 29 16:55:04.264] AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC8NP4/YDb+PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT//T88a/w/5DX+P5A1/j8AAAAA
[Jan 29 16:55:04.264] xOD6P3jLCECQywhAeMsIQJDLCEAAMABALDAAQEQwAEAs0QhAYDAAQLgwAED4MABALDEAQAjMCEDozghAHDUAQGQ1AECUNQBA0DUAQLQ2AECYPwBASNIIQBA3AEA0NwBA
[Jan 29 16:55:04.286] RM8IQPA3AEBA1AhAcDsAQExAAEBozwhAhNIIQNw7AECkzwhA6M8IQNzQCECQPQBAtD0AQPQ9AEDErAhASEEAQEStCECkQQBAwEEAQPxBAEC0rQhANEMAQHRDAEDAQwBA
[Jan 29 16:55:04.286] FEQAQFhEAEBsRABAgEQAQAhFAEA8RQBAkEUAQOBFAEA4RgBANBoJQASwCEBARwBAbLAIQPhHAECASABAREsAQKhMAEDsTABAGE0AQIxNAEDUGglAAPkIQBBOAEAs+QhA
[Jan 29 16:55:04.308] bFAAQAAAAAAMUQBAVFEAQMBRAEAEUgBAkFIAQNxSAECMUwBA8FQAQBRVAECQVQBApPwIQCz9CEDkWABAAFoAQGhaAEBMWwBAvFsAQAgHCUBQXQBA7F0AQGRfAEDIXwBA
[Jan 29 16:55:04.308] BGAAQAAAAABYYABAzGEAQGhiAECQYgBAqGIAQPwTCUBkZQBA1GUAQCxmAEAAAAAA70AVAAAAQAAAAAEAABAAAAABAAD//wAAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAAA
[Jan 29 16:55:04.330] AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Comments

  • SergeySergey Dublin, Ireland

    Can you configure your ESP32 as you wish without bluetooth, but using a common mos config-set command ?

  • mschwetzmschwetz Switzerland
    edited February 15

    yes. config-set allows to set an empty string.

    change from DHCP config to manually assigned network settings

    C:\test>mos config-set wifi.sta.ip=10.10.10.4
    Using port COM15
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    Saving and rebooting...
    Saving and rebooting...
    Error: (-1) error saving config: Station static IP is set but no netmask provided
    
    C:\test>mos config-get wifi.sta.ip
    Using port COM15
    10.10.10.4
    
    C:\test>mos config-set wifi.sta.netmask=255.255.255.0
    Using port COM15
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    

    the console shows the manually configured IP settings
    [Feb 15 10:03:28.260] mgos_wifi_dev_sta_se WiFi STA IP: 10.10.10.4/255.255.255.0 gw

    change from manually assigned network settings to DHCP

    C:\test>mos config-set wifi.sta.ip=
    Using port COM15
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    
    C:\test>mos config-get wifi.sta.ip
    Using port COM15
    
    
    C:\test>mos config-set wifi.sta.netmask=
    Using port COM15
    Getting configuration...
    Setting new configuration...
    Saving and rebooting...
    
    C:\test>mos config-get wifi.sta.netmask
    Using port COM15
    
    
    C:\test>
    

    the console shows that the ESP32 got the IP settings assigned from the DHCP server
    [Feb 15 10:06:17.267] ←[0;32mI (3136) event: sta ip: 192.168.8.108, mask: 255.255.255.0, gw: 192.168.8.1←[0m
    ...
    [Feb 15 10:06:19.003] mgos_net_on_change_c WiFi STA: ready, IP 192.168.8.108, GW 192.168.8.1, DNS 192.168.8.1

Sign In or Register to comment.