Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mDNS server issues when using the Matter Contoller application with Thread (CON-1482) #1214

Open
pavel808 opened this issue Dec 18, 2024 · 0 comments

Comments

@pavel808
Copy link

I am trying to customize the Matter Controller example which is running on an ESP Thread Border Router device.

I can't seem to get an mDNS server working with this. See my app_main() and initialise_mdns(void) below.
Everything appears to run fine and mDNS initializes ok, but not possible to ping "my-server" on the local network no matter what.

Before building the application project, I configure and set the target as follows :
idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.otbr" set-target esp32s3 .

My sdkconfig.defaults.otbr is attached also.

Then I configure the Wi-Fi credentials on the terminal via : matter esp wifi connect {ssid} {password} .
These credentials of course then stay saved on the device unless I do a complete erase and flash.

I have built and flashed other mDNS examples such as esp-idf/examples/protocols/esp_local_ctrl which work fine and can ping the hostname.
One of the differences I see with those examples is that example_connect() is used to get the Wi-Fi credentials. If I try to use example_connect() with my below code I get a crash.

I have attached an app-output.log file too which shows the terminal output from my application. I'd appreciate any help with this. Thanks

static void initialise_mdns(void)
{
    char *hostname = "my-server";

    //initialize mDNS
    ESP_ERROR_CHECK( mdns_init() );
    ESP_ERROR_CHECK( mdns_hostname_set(hostname) );
    ESP_LOGI(TAG, "MDNS hostname set to: %s", hostname);
}

extern "C" void app_main()
{
    esp_err_t err = ESP_OK;

    /* Initialize the ESP NVS layer */ 
    nvs_flash_init();

#if CONFIG_ENABLE_CHIP_SHELL
    esp_matter::console::diagnostics_register_commands();
    esp_matter::console::wifi_register_commands();
    esp_matter::console::init();
#if CONFIG_ESP_MATTER_CONTROLLER_ENABLE
    esp_matter::console::controller_register_commands();
#endif // CONFIG_ESP_MATTER_CONTROLLER_ENABLE
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
    esp_matter::console::otcli_register_commands();
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
#endif // CONFIG_ENABLE_CHIP_SHELL
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#ifdef CONFIG_AUTO_UPDATE_RCP
    esp_vfs_spiffs_conf_t rcp_fw_conf = {.base_path = "/rcp_fw", .partition_label = "rcp_fw", .max_files = 10, .format_if_mount_failed = false};
    if (ESP_OK != esp_vfs_spiffs_register(&rcp_fw_conf)) 
    {
        ESP_LOGE(TAG, "Failed to mount rcp firmware storage");
	return;
    }
    esp_rcp_update_config_t rcp_update_config = ESP_OPENTHREAD_RCP_UPDATE_CONFIG();
    openthread_init_br_rcp(&rcp_update_config);
#endif
    /* Set OpenThread platform config */
    esp_openthread_platform_config_t config = 
    {
	      .radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG(),
	      .host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(),
	      .port_config = ESP_OPENTHREAD_DEFAULT_PORT_CONFIG(),
    };
    set_openthread_platform_config(&config);
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
	  /* Matter start */
    err = esp_matter::start(app_event_cb);
    ABORT_APP_ON_FAILURE(err == ESP_OK, ESP_LOGE(TAG, "Failed to start Matter, err:%d", err));

#if CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
    esp_matter::lock::chip_stack_lock(portMAX_DELAY);
    esp_matter::controller::matter_controller_client::get_instance().init(112233, 1, 5580);
    esp_matter::controller::matter_controller_client::get_instance().setup_commissioner();
    esp_matter::lock::chip_stack_unlock();
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE

  //ESP_ERROR_CHECK(esp_netif_init());
  initialise_mdns();

  while(1)
  {
      sleep(5);
  }

}

app-output.log

sdkconfig.defaults.otbr.txt

@github-actions github-actions bot changed the title mDNS server issues when using the Matter Contoller application with Thread mDNS server issues when using the Matter Contoller application with Thread (CON-1482) Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant