ConnectPort X4 802.15.4, send MAC layer data

I have a ConnectPort X4 802.15.4 Gateway that I try to send messages to a product using a Freescale microprocessor talking IEEE 802.15.4 on the MAC layer.

I have successfully connected the product to the Gateway with the Gateway acting as a Coordinator and the product acting as an End-Device.

But now when I have moved on to the next step trying to write Python code to send messages to the product from the Gateway I’m not able to send any valid MAC layer messages.

I need to be able to route messages received from RPC calls to the IEEE 802.15.4 PAN and back.

I have tried for example the helloxbee sample project in the ESP:
import sys, os
import xbee
from socket import *

The Format of the tuple is:

(address_string, endpoint, profile_id, cluster_id)

The values for the endpoint, profile_id, and

cluster_id given below are the values used to write

to the serial port on an Ember-based XBee module.

DESTINATION=(“00:0d:6f:00:00:06:89:29!”, 0xe8, 0xc105, 0x11)

Create the socket, datagram mode, proprietary transport:

sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT)

Bind to endpoint 0x00 (IEEE 802.15.4):

sd.bind((“”, 0x00, 0, 0))

Send “Hello, World!” to the destination node, endpoint,

using the profile_id and cluster_id specified in

DESTINATION:

sd.sendto(“Hello, World!”, 0, DESTINATION)

But the message that is sent is some APS layer message.
The documentation does not cover anything about IEEE 802.15.4 communication even though the Gateway is specified to just use that medium!?

Could someone point me to the correct documentation or provide me with an example how to send the messages?

Thanks in advance.

You need to look at

DESTINATION=(“00:0d:6f:00:00:06:89:29!”, 0xe8, 0xc105, 0x11)

This line tells you specific End points, profile ID’s, and cluster ID’s to send data to.

Ok, the problem is that I can’t find any documentation on the address object.
Actually my address object on the MAC layer would only be a 16-bit or 64-bit address. But choosing: DESTINATION=(“00:0d:6f:00:00:06:89:29!”, 0x00, 0x0000, 0x00), definitely does not work.

On the MAC layer there is no End points, profiles or clusters…

Here are a little more info from the day:
Tested to send broadcast message:
import sys, os
import xbee
from socket import *

DESTINATION=(“[00:00:00:00:00:00:FF:FF]!”, 0x00, 0x000, 0x00)
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT)
sd.bind((“”, 0x00, 0, 0))
sd.sendto(“Hello, World!”, 0, DESTINATION)

This generates an APS layer message that has the string “Hello, World!” as payload and is broadcasted.
We would need to be able to send the “Hello, World!” string as a MAC layer payload instead.

Also if trying to send the message direct to a device:
DESTINATION=(“[00:0d:6f:00:00:06:89:29]!”, 0xe8, 0xc105, 0x11)
or
DESTINATION=(“[00:0d:6f:00:00:06:89:29]!”, 0x00, 0x0000, 0x00)
Generates an APS layer message that is broadcasted with the payload: 89 29 89 06 00 00 6f 0d 00 00 00.
Here we would expect and need the message to send the “Hello, World!” string as a MAC layer payload addressed at MAC level to the 00:0d:6f:00:00:06:89:29 device.

Another question that we have is how a message is sent to a 16-bit address device, the documentation at:
https://www.digi.com/wiki/developer/index.php/XBee_Extensions_to_the_Python_Socket_API
under the heading
Address tuples for data frames
States that address_string must be of the form “[nn:nn:nn:nn:nn:nn:nn:nn]!” for 64-bit addresses or “[nnnn]!” for 16-bit addresses

But sending a message like:
DESTINATION=(“[87dd]!”, 0xe8, 0xc105, 0x11)
Gives an error:
Traceback (most recent call last):
File “WEB/python/dpdsrv.py”, line 12, in ?
execfile(os.path.join(os.path.abspath(‘.’), ‘helloxbee.py’))
File “WEB/python/helloxbee.py”, line 57, in ?
sd.sendto(“Hello, World!”, 0, DESTINATION)
socket.error: (5, ‘I/O error’)

Hope someone has the answer for this…

Try

‘’’
This example sends the series 1 zigbee modules frame’s payload back to the
originator using the radio’s proprietary mesh transport.

First, the Series 1 radios have no concept of endpoints. Binding to 0xe8
is invalid, though does not cause exception. Bind to the endpoint 0.

Second, you can receive a larger frame in series 1 then series 2, increase
the size of the recvfrom(…) from the 72 specified to 256. It doesn’t matter
that we over compensate by so much, provided the amount we specify is always
greater than the maximum frame size.
‘’’

include the sockets module into the namespace:

from socket import *

Create the socket, datagram mode, proprietary transport:

sd = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)

Bind to endpoint 0x00:

sd.bind((“”, 0, 0, 0))

Block until a single frame is received, up to 256 bytes:

payload, src_addr = sd.recvfrom(256)

Send the payload back to the source we received it from:

sd.sendto(payload, 0, src_addr)

sd.close()

But keep in mind that you need to know what cluster ID, end point and profile ID works from the 3rd party manufacture. You also need to set the MM command on the radio accordingly.

What firmware version is installed on the XBee module in that gateway and do you have encryption enabled?

Hi,

I have tried to change the MM (Mac mode) AT command to 2 now, unfortunately it seems like my firmware don’t know this command. Tried two approaches in the Python code:
xbee.ddo_set_param(None, ‘MM’, 2)
Gives:
Traceback (most recent call last):
File “WEB/python/dpdsrv.py”, line 12, in ?
execfile(os.path.join(os.path.abspath(‘.’), ‘helloxbee.py’))
File “WEB/python/helloxbee.py”, line 40, in ?
print xbee.ddo_set_param(None, ‘MM’, 2)
Exception: ddo_set_param: error setting DDO parameter.

zigbee.ddo_set_param(None, ‘MM’, 2)
Gives:
Traceback (most recent call last):
File “WEB/python/dpdsrv.py”, line 12, in ?
execfile(os.path.join(os.path.abspath(‘.’), ‘helloxbee.py’))
File “WEB/python/helloxbee.py”, line 40, in ?
zigbee.ddo_set_param(None, ‘MM’, 2)
Exception: ddo_set_param: error setting DDO parameter.

sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_DDO)
sd.sendto(2, 0, (None, ‘MM’, 0, 1))
result, src_addr = sd.recvfrom(255)
print result.encode(‘hex’), src_addr[4]
Gives:
Traceback (most recent call last):
File “WEB/python/dpdsrv.py”, line 12, in ?
execfile(os.path.join(os.path.abspath(‘.’), ‘helloxbee.py’))
File “WEB/python/helloxbee.py”, line 40, in ?
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_DDO)
NameError: name ‘XBS_PROT_DDO’ is not defined

The firmware version on the XBee is: 0x21a7
Gateway: 2.17.3.2
Boot: 1.1.3
POST: 1.1.3
Edit: And encryption is not enabled from what I can tell.

That is because the MM command only accepts Hex values and not ASCII values. The code you are using is for ASCII values. Try using 0x02 for the value instead.

Sending 0x02 makes no difference unfortunately:

xbee.ddo_set_param(None, ‘MM’, 0x02)
Gives:
Traceback (most recent call last):
File “WEB/python/dpdsrv.py”, line 12, in ?
execfile(os.path.join(os.path.abspath(‘.’), ‘helloxbee.py’))
File “WEB/python/helloxbee.py”, line 40, in ?
print xbee.ddo_set_param(None, ‘MM’, 0x02)
Exception: ddo_set_param: error setting DDO parameter.

Try simply browsing to the web interface of the gateway and then setting the MM command.

Entering the web interface, under XBee Network I select the Gateway, it is setup as a Coordinator.
Then I enter Advanced Settings, there I have the following settings avaliable:
AR
BH
CR
D6
NT
EE
EO
ID
II
NJ
KY
NH
NK
NI
PL
PM
SC
SD
SN
SP
ZS

Unfortunately there is no MM setting available…

Could it be that I have the wrong version of the XBee or the Gateway?
The firmware version on the XBee is: 0x21a7
Gateway: 2.17.3.2
Boot: 1.1.3
POST: 1.1.3

Yes, the MM command is for the 802.15.4 product and not the Zigbee based product.