This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

when should a slave broadcast data?

Hi, I'm using a 51422 with a s210/s310 softdevice. I have some nodes that must exchange some independent data. So I configured the communication to be an independent bidirectional channel.

On both sides of the channel, I use the EVENT_RX to receive data. On the master side, I use the EVENT_TX to call sd_ant_broadcast_message_tx() with new data. On the slave side, I use EVENT_RX to call sd_ant_broadcast_message_tx() with new data.

Now I have the effect, that I see just half of the EVENT_TX events than I see EVENT_RX events. I interpret this as the slave is just broadcasting a new message for every second, received message.

I think the reason, why the system behaves like this is, that when the slave calls sd_ant_broadcast_message_tx() it's already to late for the ant stack to put this into the respond back to the master.

One solution, I could think of would be to use the EVENT_TX event on the slave side to send new messages and to count the number of EVENT_RX events to cope with the situation where the EVENT_TX event got somehow missed (due to channel collision, etc.). With every EVENT_TX event, I send a new message and reset the count. With every EVENT_RX, the counter will be incremented and when it rises over 3, a message would be send too.

I wonder if this sounds reasonable or if there is a much straighter / easier way to implement bidirectional communication at full channel bandwidth.

Thanks for every pointer, thought or comment,

kind regards Torsten

Parents
  • I assume you have set the channel type to be a bidirectional slave/master channel since you are able to get some packages through. Reading more closely through your text I see that you have already found the explanation, it is too late to run the sd_ant_broadcast_message_tx() on the slave side after you have received the package from the master. So the data from the slave to the master will always have to be a package behind in that sense. You have to write to the sd_ant_broadcast_message_tx() for every time you want it to. So after the RX_event on the slave you have to use the sd_ant_broadcast_message_tx() in order to send data back to the master at the next connection event.

  • Hi Asbjørn, and that's exactly the configuration we've used to the beginning. The slave uses the RX_event and calls sd_ant_broadcast_message_tx() every time a RX_event is received. And this exact approache leeads to a results, where the master counts N EVENT_TXs and N/2 EVENT_RXs, while the slave counts N EVENT_RXs and N/2 EVENT_TXs.

    So the obvious approache that we took first and that your are describing as the route to follow, is not working with the maximum possible bandwidth.

Reply
  • Hi Asbjørn, and that's exactly the configuration we've used to the beginning. The slave uses the RX_event and calls sd_ant_broadcast_message_tx() every time a RX_event is received. And this exact approache leeads to a results, where the master counts N EVENT_TXs and N/2 EVENT_RXs, while the slave counts N EVENT_RXs and N/2 EVENT_TXs.

    So the obvious approache that we took first and that your are describing as the route to follow, is not working with the maximum possible bandwidth.

Children
No Data
Related