It looks like the error is thrown when parsing a frame received on the Coordinator. If that's the case, can you dump the received frame?
The stack trace points to fs.js:454:17
-- is that your code? What's there?
If you try other samples from xbee-api
, do they work?
Somewhat unrelated, but I recommend running your coordinator at 115200 bps, and making sure you've enabled flow control in both your serial library and on the XBee module. That avoids problems with overflowing buffers. Data coming in from the network is delivered to the host before it can pile up on the XBee module.
To enable hardware flow control, set ATD6
and ATD7
on the XBee module to 1
. This requires that the host check the CTS
signal from the XBee before sending to it, and assert the RTS
signal when it's ready to receive bytes from the XBee.