i have a system where 1 coordinator and 30 routers are involved. I would like to send data from the coordinator to all the devices. When i start the transaction i have seen that when i change the adress (API frames) there is a delay os 1.2s between consequtive frames. The coordinator seems that it spends this time to search the route to the router. Is there any way to avoid this incredible delay?? I know that i can send a broadcast messenge but i prefer to send one by one. Thanks!
Notice the transmit API frame includes both 16-bit and a 64-bit address fields. The 64-bit address is required and the 16-bit address is optional. If the 16-bit address is not known, the XBee must discovery it before it can actually transmit the data.
The reason you are seeing a delay is because the coordinator can only store up to 10 or so 16-bit addresses internally. If the coordinator doesn’t know the 16-bit address of a destination, it must discover it by sending a broadcast address discovery command. If you could provide the 16-bit address for each transmission, this delay would go away.
You can discover the destination 16-bit address from the transmit status frame you get when the transmission completes and store it into a small address table in your application. The 16-bit address is also included in the RX Data API frames (0x90, 0x91) when you receive data from a remote device.
When you send an API data transmission, set the 16-bit address field in the transmit API frame to the 16-bit address you stored into your address table. If the 16-bit address is not known, set it to 0xFFFE. Since the 16-bit address on a device can potentially change, make sure to update the 16-bit address in your table anytime you get an RX Data API frame or a transmit status.