ESP-Mesh - Multiple messages transmitted

NielsPost
Posts: 2
Joined: Tue Mar 28, 2023 8:52 am

ESP-Mesh - Multiple messages transmitted

Postby NielsPost » Tue Mar 28, 2023 9:09 am

I am using ESP-IDF with esp_mesh to synchronise time between multiple ESP32 Nodes.
Most of this works fine, except I am noticing the following happening:

- Node A sends message to Node B, but gets an ESP_ERR_MESH_TIMEOUT from the esp_mesh_send call
- Node B does receive this message
- Going forward after the timeout, every message that node A sends is received by other nodes twice

The issue seems to be on the transmit side. When I reboot every other (receiving) node, and let them reconnect, they still receive double messages.

The issue also seems to stack. So after 3 of these timeouts, messages are received 4 times instead of 1.

I am using the following code to transmit:

Code: Select all

  mesh_data_t dataType{
      .data = (uint8_t*) &m_tcpSendBuffer,
      .size = static_cast<uint16_t>(data.size() + sizeof(PacketHeader_t)),
      .proto = MESH_PROTO_BIN,
      .tos = MESH_TOS_P2P};
      
      auto sendResult = esp_mesh_send(&espDestination, &dataType, MESH_DATA_P2P, nullptr, 0);
and the following code to receive

Code: Select all

	  mesh_data_t dataInfo{
      		.data = (uint8_t*) &m_tcpReceiveBuffer,
      		.size = static_cast<uint16_t>(TCP_PACKET_SIZE)
      		};
  	int flag = 0;

 	auto receiveResult = esp_mesh_recv(&sourceMacAddress, &dataInfo, 0, &flag, nullptr, 0);

From logging on the sender side, I can confirm that esp_mesh_send is only called once.

Is there any parameter I should be looking at to help prevent this issue? Or should I be clearing some buffer when an error occurs?


Sidenote is that I am using ESP_Mesh ESP_now simultaneously in this project. I expect this to work, but perhaps I am missing something?

greg-solargik
Posts: 12
Joined: Wed Aug 04, 2021 8:45 am

Re: ESP-Mesh - Multiple messages transmitted

Postby greg-solargik » Thu Aug 15, 2024 9:43 am

We are seeing this issue as well. Have you found a resolution to this?

NielsPost
Posts: 2
Joined: Tue Mar 28, 2023 8:52 am

Re: ESP-Mesh - Multiple messages transmitted

Postby NielsPost » Thu Aug 15, 2024 2:49 pm

Hi Greg,

I'm afraid that I haven't found a solution for this problem. Due to this, and other issues that came up during development, we decided to drop the mesh library completely.

For our project, I wrote a replacement which uses ESP-NOW to manually form a mesh network with the required properties. This was enough in our case, but such a solution might be inappropriate or insufficient for your use case.

Regards,
Niels

Who is online

Users browsing this forum: jsmith56x and 295 guests