Search code examples
xbeenode-serialport

Reading response from a TOSR0X-T relay remotely connected with XBee module


I'd like to get the states of the relays on the board from the relay, but I can get only ACK back.

I have two XBee modules, one is connected to a computer with USB, and acts as a Serial device, the other is connected to a TOSR0X-T relay. I am planning to add more XBee modules to the network with more relays later, so I am using API mode, not the simple AT mode, because I need to address them separately.

I am sending TX frames with 64bit address to the remote XBee to open or close relays. That works fine, I get the ACK response frames properly. However if I send a message to get the relay states by sending 0x5B, I get back an ACK only, and I can find no way to get the actual data back indicating the relay states.

I am using node-serialport and the X-CTU software, but could not read the data, and the only example I found used both XBees connected to the same machine - that way an RX appeared on the destination XBee - but I need to get that remotely somehow.

TOSR0X-T documentation here only tells me about talking to it via TX messages, so I have no clue if I can achieve anything with commands (and how to do that).


Solution

  • After some experiments I could solve my problem.

    Considering the CH (Channel) and ID (PAN ID) are matching - that is a requirement to be able to set up the network, I set up my XBees like this:

    The Coordinator XBee (the one attached to the computer):

    CE = 1 (for being coordinator)
    MY = 0001
    DH = 0
    DL = 0
    AP = 1 (in API mode)
    

    The first End Point (the one attached to the TOSR0X-T):

    CE = 0 (for being an endpoint)
    MY = 000A (whatever you want), use FFFF for 64 bit responses
    DH = 0
    DL = 0001 (This is one I missed. It should be the Coordinator's MY)
    AP = 0 (in AP mode)
    

    So basically I did everything right, except the DH/DL addressing. For the Endpoint the DL must be set to the MY of the Coordinator. I read some articles where using FFFF and FFFE and things like that to set broadcasting, and I think I was confused by those informations.