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
  • The channel period is 20ms. Both sides use the exactly same software and thus the same configuration of the channel period. Yes, I've search for help in the examples but found only the ANT tx/rx examples in the nRF51 SDK, but this examples implement just unidirectional communication. In this example, the master is sending, the slave is receiving. What we are trying to achive is bidirectional communication as mentioned in ANT_Message_Protocol_and_Usage_Rev_5.1 chapter 5.1 (Figure 5-2.). -> the master is sending and receiving data from the slave. The slave is receiving data from the master and sending data back. Two independent streams of data.

Reply
  • The channel period is 20ms. Both sides use the exactly same software and thus the same configuration of the channel period. Yes, I've search for help in the examples but found only the ANT tx/rx examples in the nRF51 SDK, but this examples implement just unidirectional communication. In this example, the master is sending, the slave is receiving. What we are trying to achive is bidirectional communication as mentioned in ANT_Message_Protocol_and_Usage_Rev_5.1 chapter 5.1 (Figure 5-2.). -> the master is sending and receiving data from the slave. The slave is receiving data from the master and sending data back. Two independent streams of data.

Children
No Data
Related