1

I want to setup an xBee network with four serial 1 modules. Any two of them can communicate with each other in two-way. The transmitted data is string other than a single byte.

My original design is to setup a nonbeacon (with coordinator) network: One module is configured as coordinator. The left three modules is configured as end devices. The coordinator broadcasts the data from end devices.

The communication workflow is: If end device 1 want to send data to end device 2, it sends data to coordinator first. Then the coordinator broadcasts the data received from end device 1. End device 2 can receive the broadcast data. The communication workflow finishes.

I want the received string to be atomic. If end device 1 and end device 3 send out the data in the same time, there would be conflict. The two strings would combined together. And the end device 2 can't distinguish which byte is from which device. That is, end device 1 sends out string "{AAAA}" (quotes aren't included). In the meanwhile, end device 3 sends out string "<2222>". The end device 2 may receive the string like "{A<22AA2A2}>", which isn't what I want. My expected string is "{AAAA}<2222>" or "<2222>{AAAA}".

How do I setup the network to meet my requirements?

4

1 回答 1

2

使用 Digi 的 XBee 模块有两种方法可以实现原子传输。该方法取决于是否使用 API 模式(AP 参数 > 0)。

如果未使用 API 模式 (AP = 0),则可以通过将 RO 时间设置为大于您将从节点之一发送的最长字符串的字符数来鼓励数据的原子性。这将使 XBee 缓冲区在开始无线传输之前等待指定数量的字符时间(以特定波特率发送字符所需的时间)。注意:您必须确保将整个字符串一次全部发送到收音机,以便此方案起作用。

如果正在使用 API 模式(AP > 0),那么很容易获得您想要的行为。您只需使用 Tx 请求帧(API 帧类型 0x1)并指定要发送的字符串数据。数据将始终以原子方式发送。

如果在接收节点(即在这种情况下为协调器)上使用 API 模式,则帧数据也将始终以原子方式到达。

请参阅Digi XBee 802.15.4 产品支持页面以获取有关如何使用 API 模式的更多信息,并在 Internet 上搜索许多精彩的 XBee 库,这些库使您可以轻松地在 API 模式下使用 Digi XBee 模块。

于 2012-05-31T19:14:57.130 回答