How to send broadcast and multicast

Michelangelo
Posts: 5
Joined: Wed Mar 25, 2020 7:40 am

How to send broadcast and multicast

Postby Michelangelo » Wed May 20, 2020 12:42 pm

MDF + IDF 3.3.1

How to send a broadcast message?
When I do at root node:

Code: Select all

mwifi_root_write( MWIFI_ADDR_BROADCAST, 1, data_type.communicate=MWIFI_COMMUNICATE_BROADCAST, data, length, false)
I get a message:
  1. W (41967) [mwifi, 645]: <ESP_ERR_MESH_NO_ROUTE_FOUND> Node failed to send packets, dest_addr: ff:ff:ff:ff:ff:fe, flag: 0x14, opt->type: 0x08, opt->len: 13, data->tos: 2, data: 0x3ffbd7b8, size: 11
  2. W (41979) [mwifi, 1228]: <ESP_ERR_MESH_NO_ROUTE_FOUND> Root node failed to send packets, dest_mac: ff:ff:ff:ff:ff:fe
Replacing address parameter MWIFI_ADDR_BROADCAST with MWIFI_ADDR_ANY solves warnings, but root also receives its packet (mwifi_root_read).
Warnings solves also MWIFI_ADDR_BROADCAST and data_type=0, but I'm not sure the communication type is broadcast in this case.

The same question about multicast.

Unicast with a list of MACs and data_type = 0 works well.

ksnboopa
Posts: 9
Joined: Sun May 03, 2020 3:19 pm

Re: How to send broadcast and multicast

Postby ksnboopa » Tue Oct 13, 2020 3:35 am

You can alternatively broadcast messages to all nodes using below code

Code: Select all

const uint8_t _end_dest_node[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
mwifi_root_write(_end_dest_node, 1, &data_type, data, len, true);
Just like unicast with destination as "ff:ff:ff:ff:ff:ff".

Let me know if it works.

Who is online

Users browsing this forum: No registered users and 10 guests