Reply
Highlighted
Posts: 38
Registered: ‎08-11-2017

Mesh: segmented vendor message only received once

Hello,

I have noticed that if I publish a vendor model message with more than 8 bytes the other nodes generate a gecko_evt_mesh_vendor_model_receive_id event the first time that the message is broadcast, but do not upon subsequent broadcasts.

 

Initially I thought that the messages might be filtered because they were already in the receiving nodes message cache, but when I switched from a fixed payload to a variable payload (each byte of the payload is incremented each time a message is published) the same behavior persists.

 

Messages sent with a payload length <= 8 bytes do not have this problem and generate gecko_evt_mesh_vendor_model_receive_id events every time a message is broadcast.

 

I am publishing the message with this sequence of commands (error checking removed to be concise):

gecko_cmd_mesh_vendor_model_clear_publication(_my_index, vendor_id_, model_id_);
gecko_cmd_mesh_vendor_model_set_publication(_my_index, vendor_id_, model_id_, opcode1, final, 9, (uint8*)"012345678");
gecko_cmd_mesh_vendor_model_publish(_my_index, vendor_id_, model_id_);

 

Any ideas why this is happening?

 

Thanks,

Rob

Posts: 2,724
Registered: ‎09-01-2015

Re: Mesh: segmented vendor message only received once

I tried to reproduce this problem. I was able to send multiple segmented (9-byte) vendor commands. However, in my test I noticed that at some point the gecko_cmd_mesh_vendor_model_set_publication returned error code 0x182 (out of memory) and then the vendor messages stopped working.

 

Have you checked the errors in your test code and did you see any non-zero return values?

Posts: 38
Registered: ‎08-11-2017

Re: Mesh: segmented vendor message only received once

I am checking for errors and I have seen error 0x182 in this instance. Adding a call to gecko_cmd_mesh_vendor_model_clear_publication before I call gecko_cmd_mesh_vendor_model_set_publication seems to have dealt with it because I haven't seen error 0x182 when publishing messages again since then.

 

How long did you need to wait between transmissions for your test case? Are you sending to a group address or a specific node's mesh address?

 

I noticed towards the end of yesterday that the problem is slightly different than I was thinking when I first posted this.

I found that I am able to resend messages, however, there must be a delay of approximately 45 seconds for the 9 byte command between calls to gecko_cmd_mesh_vendor_model_publish and about 2 minutes for commands with 150 bytes. I expect more latency for the segmented messages, but this seems like it is a very large delay for the added overhead of sending one more PDU (in the 9 byte case).

Posts: 24
Registered: ‎09-29-2015

Re: Mesh: segmented vendor message only received once

I've had success with a minor variation to your steps:

 

gecko_msg_mesh_vendor_model_set_publication_rsp = gecko_cmd_mesh_vendor_model_set_publication(0, 0x02ff, 0xabcd, 0x01, 0x01, received+6, tx_payload);        
if(gecko_msg_mesh_vendor_model_set_publication_rsp->result == 0){
       	printf("setting vendor model pub successful!");
}

gecko_msg_mesh_vendor_model_publish_rsp = gecko_cmd_mesh_vendor_model_publish(0x0000, 0x02ff, 0xabcd);
if(gecko_msg_mesh_vendor_model_publish_rsp->result == 0) {
       	printf("publishing to vendor model successful!");
}

gecko_msg_mesh_vendor_model_clear_publication_rsp = gecko_cmd_mesh_vendor_model_clear_publication(0x0000, 0x02ff, 0xabcd);
if(gecko_msg_mesh_vendor_model_clear_publication_rsp->result == 0) {
       	printf("clearing publish successful!");
}

where tx_payload is a uint8_t array that contains 6+variable length bytes, usually ~20 bytes total.  The only other difference with my code is that I clear the publication after it is published rather than just before, though I doubt that is your particular problem.  I'm curious to know what your solution will be.

Posts: 2,724
Registered: ‎09-01-2015

Re: Mesh: segmented vendor message only received once

[ Edited ]

Thanks @jpreston and @rjohnson for the additional input. Reading the API specification, I don't think the vendor publication should be cleared explicitly after each publish but I need to verify this with our stack experts. The API doc says:

 

"To disable publication the publication message may be erased using the clear vendor model publication message command."

 

I am interpreting this so that the clear command is needed only if you want to disable publishing. This could be needed if the model is configured to publish periodically.

 

@rjohnson in my tests I triggered the transmissions by a pushbutton and I did not have any fixed interval between transmissions, just pushing the button quite fast (< 1 sec between presses). My app runs out of memory after a few dozen presses.

 

This is easy to reproduce now, there's either something missing in the application or then some memory leak or similar in the stack. I will let you know as soon as I have some more details.

 

Posts: 38
Registered: ‎08-11-2017

Re: Mesh: segmented vendor message only received once

Interesting, @jpreston. I switched to calling last as you described and there doesn't seem to be any change in behavior that I have noticed yet. I would be interested to know the same things that I asked @JaakkoV, are you publishing to a group address or a specific node and how long of a delay do you have between calls to gecko_cmd_mesh_vendor_model_publish

Posts: 24
Registered: ‎09-29-2015

Re: Mesh: segmented vendor message only received once

@rjohnson, I'm publishing to a group address every 10 seconds.  I have a soft timer setup to set high an I/O pin which turns on a sensor that transmits a UART message to the node with some readings (my variable length TX message).  In the IRQ receive handler is where the vendor model publish code exists so that the sensor message gets published as soon as it is received.

 

It's been running for about an hour now without getting any errors.

Posts: 38
Registered: ‎08-11-2017

Re: Mesh: segmented vendor message only received once

Hi @JaakkoV, I interpreted the API doc to mean that the call to the clear command was optional as well initially, but found that I could avoid that error if I called it so I started using it.

 

I just switched from publishing to a group address (which I was doing up until now) to publishing directly to another node's mesh address and the problem I am having with latency is much reduced, I can send 180 byte messages at ~5 second intervals with most coming through, although after about 5 there will be a delay of ~10 seconds until the last message is received and I can continue sending messages. If I remember correctly the mesh specification requires segmented messages sent to unicast addresses to be acknowledged, so I can understand why this is faster than sending to a group address, but the delay of 45 seconds I have been seeing with group messages seems excessively long compared with what jpreston is reporting.

 

@jpreston, you're getting better results than I am, so perhaps I have something in my application code that is causing this delay. I am not sure what it might be at this point though, your function calls are essentially identical to mine. From the code snippet you posted it looks like you have switched to C, are you using the C API in the case you are describing as well?

Posts: 24
Registered: ‎09-29-2015

Re: Mesh: segmented vendor message only received once

@rjohnson, yes I am using the C API.  I was using NCP nodes to test the flow of commands to verify everything worked before writing firmware.  I am still using an NCP node as the subscriber to the vendor model, as well as another one that I use to provision both nodes.

 

This makes me wonder if the issue is on the receiving side?  What does your receive/subscribe node setup look like?

Posts: 38
Registered: ‎08-11-2017

Re: Mesh: segmented vendor message only received once

I had thought that something might be going on with the receiving side as well initially, but really there isn't much going on. I take the payload from the gecko_evt_mesh_vendor_model_receive_id event and send it out through the UART. 

 

To make sure that printing the entire payload is not causing a problem with timing I set the node to print 'rx' when the receive event is generated without any of the processing that had been happening before. I see the same sorts of delays before the message is received with the shortened output as I did before.

 

I can't think of anything else that I am doing that would have much effect of the rx side. I set up three nodes with the same code which is the light example extended to add provisioning abilites and the vendor model I am using. One of the nodes is initialized as a provisioner and is used to provision and configure the other pair of nodes. When configuring the vendor model the publication and subscription addresses are set to a group address. I then set and publish a message as I described above. All of the nodes are next to each other on my desk.

Posts: 24
Registered: ‎09-29-2015

Re: Mesh: segmented vendor message only received once

Interesting.  I've noticed some issues myself now that things have been running for a while.  My publishing node will still report successful publishes even though I don't see anything being received on the other side.  Pressing the reset button fixes this (no change on the receive node).  It does take a while for this issue to happen (a couple hours).

 

It feels like some memory bugs are in the vendor model publish code, as was alluded to earlier in this thread.  However, I didn't really test generic models for very long before moving to vendor models.  For now I'm comfortable having a reset be part of some timing event to clean-up whatever is causing this issue, but I'll be curious to know what @JaakkoV reports back with after investigating further.