I have 5 Xbee S2B radios, 1x set as Zigbee Coordinator AT and 4x set as Zigbee Router AT. The aim is to send strings to each of the routers from the coordinator. the strings are generated on a laptop and are different for each router.
AT the moment, I am using multiple unicast transmissions switching the DH and DL parameter of the Coordinator every time I need to send a String to a different router.
Is there a fastest way of transmitting the strings? Broadcast?
Sure, use API mode. This way each TX request packet includes in it the 64 bit address of who you want the data to be sent to. This keeps you from having to enter command mode and change the address each time.
Thanks mvut,
I thought about doing that but I am not totally clear about two things:
How I include a string (or a byte and an int for instance, say for example A100) into an API frame.
This means the routers have to send a Tx request correct? Do they have to send a specific request for every string or can they just send a specific request? And how do they know when there is new data for them?
Sorry if I what I am asking sounds wrong, not an expert (yet!!!)
The API frame that the XBee module uses is pretty straight forward.
You have a Start Delimiter (7E), Some length bytes (xx xx), a Frame ID (17), a packet ID(xx), the 64 bit address of who you want to send it to, the network address (FFFF), the option byte and then the data payload. This is where you would put your A100 or anything else you want to send, followed by a checksum.
Hi mvut,
thank so much for your help, really appreciated!
I was looking at the manual and If I understood correctly, I should send a ZigBee Transmit Request, Frame type: 0x10, where the max payload size is defined by the NP parameter. Correct?
Sounds pretty straight forward! A couple more questions:
Can I just send a ZigBee Transmit Request API frame at any time form the coordinator and the receiving router will get it?
Do I have to setup the receiving routers as API routers in order to read the API frames coming form the coordinator?
Can the coordinator be set as coordinator AT or does it need to be API too?
Isn’t it a bit inconvenient having to calculate the checksum for every single API frame I send? I may have about 100 different ones.
Yes that is correct.
Yes, you can send a TX request packet any time you want and the node that has the matching address will out put it on its UART.
The coordinator can be either or. Just note that if you want to issue an API frame from your processor to the Coordinator that is connected to it via the UART, that coordinator or node must be in API mode.
If you do it right your code should be able to assemble the packet and calculate the checksum properly all on its own.
I tried setting the coordinator as API and the routers as AT. The coordinator is connected via UART to my computer running processing. The AT routers are connected to Arduinos listening for incoming serial messages.
Does it matter what the DH and DL parameters of the API coordinator are set to? It shouldn’t right? As the destination id is stated in the API frame, correct?
Also, can I leave the 16-bit address as 0xFFFE (Unknown)?
I tried formatting the API frame to send via the coordinator this way (see below) but didn’t manage to receive it at the router’s end. I set the 5th byte as 0x00 (no response). Should I set it to 0x01 to help troubleshooting? Can you see anything plainly wrong?