MESH Broadcast Message

Posts: 2
Joined: Thu Aug 23, 2018 9:01 pm

MESH Broadcast Message

Postby rshumate » Thu Aug 23, 2018 9:29 pm

Board: Sparkfun ESP32 Thing
Branch: master
Network Configuration: 4 Layers - 1 Device per Layer - 4 Devices Total (root <--> dev1 <-->dev2 <-->dev3)

I am currently evaluating the ESP32's Mesh network and have come across an unexpected behavior in the Mesh. I am using the Broadcast MAC Address as the to parameter for sending data on the network. Typically all four devices will receive the broadcasted message from each device. However, occasionally it appears that lower layer devices will quit receiving broadcast messages from the root or higher layer devices. I am running a modified version of the internal_communication example that broadcasts a message from each device every 5 seconds with the device's MAC address and an incremented value.

If anyone attempts to recreate the issue, it is easily seen by bringing all four devices online. If they do not exhibit the issue to start with, reboot the layer 3 device and once the layer 3 device has reconnected, my results are showing that the layer 3 and 4 devices no longer receive broadcast messages from layer 1 or layer 2.

Is using the Broadcast MAC a valid way to send a Broadcast Message over the mesh?

Additional Variable Definitions

Code: Select all

static const mesh_addr_t broadcast_group_id = {.addr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
typedef struct {
    uint8_t nodeId[6];
    uint32_t val;
} mesh_data_node_t;
Modified TX Function

Code: Select all

void esp_mesh_p2p_tx_main(void *arg)
    int i;
    esp_err_t err;
    int send_count = 0;
    mesh_addr_t route_table[CONFIG_MESH_ROUTE_TABLE_SIZE];
    int route_table_size = 0;
    mesh_data_t data;
    mesh_data_node_t node; = &node;
    data.size = sizeof(node);
    data.proto = MESH_PROTO_BIN;
    data.tos = MESH_TOS_DEF;
#endif /* MESH_P2P_TOS_OFF */


    is_running = true;
    while (is_running) {

        if (esp_mesh_is_root()) {
            ESP_LOGI(MESH_TAG, "I AM ROOT");

        // ESP_LOGI(MESH_TAG, "Sending Group Message - %d", node.val);
        err = esp_mesh_send(&broadcast_group_id, &data, MESH_DATA_P2P, NULL, 0);
        if (err) {
            ESP_LOGE(MESH_TAG, "Error Sending Messsage to Group... %d", err);

        esp_mesh_get_routing_table((mesh_addr_t *) &route_table,
                                   CONFIG_MESH_ROUTE_TABLE_SIZE * 6, &route_table_size);
        for (i = 0; i < route_table_size; i++) {
                "[ROUTE-TABLE][L:%d][rtableSize:%d]parent:"MACSTR" Node:"MACSTR"",

        vTaskDelay(5 * 1000 / portTICK_RATE_MS);
Modified RX Function

Code: Select all

void esp_mesh_p2p_rx_main(void *arg)
    int recv_count = 0;
    esp_err_t err;
    mesh_addr_t from;
    int send_count = 0;
    mesh_data_t data;
    mesh_data_node_t *node;
    int flag = 0; = rx_buf;
    data.size = RX_SIZE;

    is_running = true;
    while (is_running) {
        data.size = RX_SIZE;
        err = esp_mesh_recv(&from, &data, portMAX_DELAY, &flag, NULL, 0);
        if (err != ESP_OK) {
            ESP_LOGE(MESH_TAG, "err:0x%x, size:%d", err, data.size);

        node = (mesh_data_node_t *);

        ESP_LOGI(MESH_TAG, "Got Message from: "MACSTR" - %d", MAC2STR(node->nodeId), node->val);


Posts: 70
Joined: Thu May 17, 2018 2:26 am

Re: MESH Broadcast Message

Postby ESP_Alvin » Fri Aug 24, 2018 1:52 am

Since this is a post regarding Mesh, move the post to ESP-MDF.

Posts: 35
Joined: Wed Dec 09, 2015 6:39 pm

Re: MESH Broadcast Message

Postby captain_morgan » Sun Nov 04, 2018 8:57 pm

Curious if anyone made progress on this. I'm trying to get group sending to work but having no luck.

In addition to the code above, I'm adding the MESH_DATA_GROUP flag as per the API guide. But yeah, still nothing.

Posts: 66
Joined: Wed May 16, 2018 12:31 pm

Re: MESH Broadcast Message

Postby ESP_yudong » Wed Nov 21, 2018 12:16 pm

I have some tests on broadcast message, and the device could continues to receive messages after it was re-connected.
Would you please provide some logs here? I'm afraid I didn't get your point.

By the way, MESH_DATA_GROUP is not needed.

Who is online

Users browsing this forum: No registered users and 2 guests