ESP-MESH without a router

Snedig
Posts: 9
Joined: Sat Apr 04, 2020 3:18 pm

ESP-MESH without a router

Postby Snedig » Sat Apr 04, 2020 3:31 pm

Hi,

I am trying to set up a WiFi MESH-network without a router (root node will transmit information via onboard 4G), and I am using ESP-IDF to support chain topology.

I have managed to make the mesh connect nicely, nodes are recognized and the root is set based on external criteria (currently just a strap on a GPIO).

However, none of my messages seem to be received on any of the devices whatever I do.

The relevant parts of my code are:
Mesh init (all router settings commented out):

Code: Select all

mesh_cfg_t cfg = MESH_INIT_CONFIG_DEFAULT();
    /* mesh ID */
    memcpy((uint8_t *) &cfg.mesh_id, MESH_ID, 6);
    /* router */
    //cfg.channel = CONFIG_MESH_CHANNEL;
    //cfg.router.ssid_len = strlen(CONFIG_MESH_ROUTER_SSID);
    //memcpy((uint8_t *) &cfg.router.ssid, CONFIG_MESH_ROUTER_SSID, cfg.router.ssid_len);
    //memcpy((uint8_t *) &cfg.router.password, CONFIG_MESH_ROUTER_PASSWD,
           //strlen(CONFIG_MESH_ROUTER_PASSWD));*/
    /* mesh softAP */
    ESP_ERROR_CHECK(esp_mesh_set_ap_authmode(CONFIG_MESH_AP_AUTHMODE));
    cfg.mesh_ap.max_connection = CONFIG_MESH_AP_CONNECTIONS;
    memcpy((uint8_t *) &cfg.mesh_ap.password, CONFIG_MESH_AP_PASSWD,
           strlen(CONFIG_MESH_AP_PASSWD));
    ESP_ERROR_CHECK(esp_mesh_set_config(&cfg));
This returns " mesh: [MANUAL]designated as root and router is not set".

My mesh_send commands look like this:

Code: Select all

//node send to root
err = esp_mesh_send(NULL, &data, MESH_DATA_P2P, NULL, 0);

//root send to nodes
for (i = 0; i < route_table_size; i++) {
err = esp_mesh_send(&route_table[i], &data, MESH_DATA_P2P, NULL, 0);
}
This all works perfectly fine when a router is connected, but not at all when I do not have a router connected.

I would be thankful for any tips as I'm banging my head against the wall at the moment.. :)

Snedig
Posts: 9
Joined: Sat Apr 04, 2020 3:18 pm

Re: ESP-MESH without a router

Postby Snedig » Sun Apr 12, 2020 6:49 am

I did figure this out, although I rewrote my whole program from scratch, so I'm a little bit unsure what the problem was.

I think I didn't successfully set esp_mesh_set_self_organized on the root node in the old program.

Who is online

Users browsing this forum: Google [Bot] and 16 guests