XBee RX data disappears in MATLAB


I am trying to access an XBee shield in MATLAB using a sparkfun XBee explorer under Linux (Fedora). The process should be quite straight forward:

The XBee module attaches to the explorer and that is hooked up via USB. Then in MATLAB

Open a connection …

s = serial(['/dev/tty' port]);

Define and send an API Frame (I used X-CTU to make sure my module is in API mode) …

frame=[cast(hex2dec('7E'), 'uint8'), 0, 4, 8, uint8('R'), uint8('D'), uint8('L'), cast(hex2dec('15'), 'uint8')]
fwrite(s, uint8(frame))

see if any response is waiting …


If I send the exact same bytes in a terminal program I actually do get a response. If I do it in MATLAB, the green RX led of the XBee explorer lights up, indicating that the XBee module sent some response data, but MATLABs buffer stays empty.

The terminal program works, but is quite erratic. For, example, it usually misses the ‘O’ in the ‘OK’ of the AT command response and requires several attempts for each input until it responds once.

So why would data that was apparently send from the module not end up at my computer?

Thanks for your help …

Is your remote XBee sleeping? or always awake?