Sample codes to communicate with ZED by ZC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sample codes to communicate with ZED by ZC

Jump to solution
2,836 Views
diaskuo
Contributor II

Hi everyone,

I have both a TWR-KW24D512 (MKW24D512 Microcontroller Tow) and a MKW24D512VHA5 (ZC) connected to a host processor via SPI (maybe change SPI to UART).

My goal is to communicate with ZED by the ZC on the host using ZTC.

I got a example below to toggle a Philips Hue light on i.MX6 host via UART, and I know that sending correct ZTC commands to a ZC (ZigBee KW20) can communicate with a ZED (light).

Does NXP provide any sample codes to communicate with ZED by ZC connected to the host using ZTC?

May I have a easy way to call some functions to do it?

For example, called connect() and action() function, then the functions can generate corresponding ZTC commands to communicate with ZED by ZC via SPI or UART.

In addition, I cannot find opcode group 0xA3 and opcode 0x52 in BeeStack BlackBox ZigBee Test Client (ZTC) Reference Manual (Rev. 1.6, 07/2014, BSBBZTCRM.pdf).

[Example to toggle the light]

echo ‐en '\x02\xA3\x52\x03\xC0\x01\x10\x23' > /dev/ttyACM0

echo ‐en '\x02\xA3\x52\x03\x80\x01\x08\x7B' > /dev/ttyACM0

echo ‐en '\x02\x70\x50\x10\x02\xFF\xFF\x00\x00\xD0\x00\x00\x00\x0B\x06\x00\x08\x00\x05\x02\xE0' > /dev/ttyACM0

Thank you for your help.

Best regards,

Dias

0 Kudos
1 Solution
2,297 Views
EarlOrlando
Senior Contributor II

Hello Dias,

I know that you are using a host processor to send the ZTC commands, however I'd like to add tat you can do this through UART and the Test Tool.

Getting started with the ZTC commands

I attached the process I followed to connect a board to an Appliance Module​ through ZTC commands. I connected a USB dongle with a BlackBox application inside to my PC.

Also, I recommend you to take look into the ZigBee Application User's Guide, specially the section 8 "Creating a BeeStack BlackBox Binary" where you will create an OnOffLight and an OnOffSwitch from a BlackBox application. Since this guide only creates the network and configures the devices but there is not an application involved (i.e. A LED mapped to the OnOff state), you will need a sniffer to catch the data packets between both devices.

Best regards,

Earl.

View solution in original post

0 Kudos
6 Replies
2,298 Views
EarlOrlando
Senior Contributor II

Hello Dias,

I know that you are using a host processor to send the ZTC commands, however I'd like to add tat you can do this through UART and the Test Tool.

Getting started with the ZTC commands

I attached the process I followed to connect a board to an Appliance Module​ through ZTC commands. I connected a USB dongle with a BlackBox application inside to my PC.

Also, I recommend you to take look into the ZigBee Application User's Guide, specially the section 8 "Creating a BeeStack BlackBox Binary" where you will create an OnOffLight and an OnOffSwitch from a BlackBox application. Since this guide only creates the network and configures the devices but there is not an application involved (i.e. A LED mapped to the OnOff state), you will need a sniffer to catch the data packets between both devices.

Best regards,

Earl.

0 Kudos
2,296 Views
diaskuo
Contributor II

Hi Earl,

Does NXP provide API or tool (such as the Test Tool on Windows) to send the ZTC commands and receiving the responses on Linux?

Would you please help to convert images sharpness in 3-Series Appliance Module (4257050-RZHAC).pdf?

In addition, I cannot receive my lamp module's (4257050-ZHAC) response after running below commands using the Test Tool.

The lamp module has connected the plug, keep pressed the push button while it is pluged untile the LED start blinking.

What is the command I missed?

TX: ZTC-ModeSelect.Request 02 A3 00 0B 01 00 00 00 00 00 00 02 00 02 00 A9

TX: ZTC-ModeSelect.Request 02 A3 00 0B 01 00 00 00 00 00 00 02 00 02 00 A9

RX: ZTC-ModeSelect.Confirm 02 A4 00 01 00 A5

TX: ZTC-SetChannel.Request 02 A3 13 01 0B BA

RX: ZTC-SetChannel.Confirm 02 A4 13 01 00 B6

TX: NLME-SET.Request 02 A3 23 06 80 00 01 02 34 12 23

RX: NLME-SET.Confirm 02 A4 23 01 00 86

TX: ZTC-GetPanID.Request 02 A3 14 00 B7

RX: ZTC-GetPanID.Confirm 02 A4 14 03 00 34 12 95

TX: ZTC-StartNwkEx.Request 02 A3 E7 03 C0 10 00 97

RX: ZTC-StartNwkEx.Confirm 02 A4 E7 01 00 42

RX: ZDO_EventOccurred.Indication 02 A0 E6 01 00 47

RX: ZDO_EventOccurred.Indication 02 A0 E6 01 01 46

RX: ZDO_EventOccurred.Indication 02 A0 E6 01 03 44

RX: NLME-SET.Request 02 A3 23 0C 9A 00 01 08 DB 48 E3 65 05 C2 50 00 9D

RX: NLME-SET.Request 02 A3 23 06 96 00 01 02 00 00 13

RX: NLME-SET.Request 02 A3 23 06 80 00 01 02 34 12 23

RX: NLME-SET.Request 02 A3 23 05 D3 00 01 01 0B 5D

RX: NLME-SET.Request 02 A3 23 05 D3 00 01 01 0B 5D

RX: ZDO_EventOccurred.Indication 02 A0 E6 01 10 57

Best regards,

Dias

0 Kudos
2,295 Views
EarlOrlando
Senior Contributor II

Hello Dias,

I attached the same document with better resolution.

I am sorry but NXP only provides the Test Tool for Windows and there is not another tool doing what you are asking for for linux.

About the commands, everything seems to be ok, could you please confirm that the lamp's module is sending the expected data after pressing the button? I suspect that there is the problem. I think that a sniffer (your board can work as sniffer) will help you.

Best regards,

Earl.

0 Kudos
2,295 Views
diaskuo
Contributor II

Hi Earl,

How can I to do it if I want to access my ZC (BlockBox) via UART on Linux?

Do you have sample or example codes?

I tried the sniffer feature in the Test Tool, and it seems that a channel has to be selected before starting sniffer.

How can I sniffer on correct channel for the lamp module?

Can the sniffer feature sequentially scan all channels?

Thank you for your help.

Best regards,

Dias

0 Kudos
2,295 Views
EarlOrlando
Senior Contributor II

Hello,

For the first question you need to find a hypeterminal application capable to send information through the UART port. In windows, there is an application called Docklight which has features helpful on this purpose (such predetermine some strings to send over UART), I suggest you to look for a similar application for linux.

About the sniffer, if you are using the one included on the Test Tool 12, in the main screen press the channel you wan to sniff to start sinffering there.

Earl.

0 Kudos
2,296 Views
diaskuo
Contributor II

Hi Earl,

It's not easy to use if NXP doesn't support API.

For instance, a host program sends a ZDP-SimpleDescriptorRequest command to the ZC (BlackBox) via UART,

and then the program received the ZDP-SimpleDescriptorResponse from the ZC via UART.

It means that the program has to parse the response to find related data such as clusters,

and preparing the ZDP-BINDRequest packet for binding.

NXP provides a variety of ZTC commands, but the host program has to handle all the ZTC command responses without the API.

Do you know how other developer handle this situation on host?

About the sniffer, I only have a TWR-KW24D512, so I cannot do both sniffer and connection.

Will the packets of lamp module start on channel 0x0B if a ZC has selected channel 0x0B to start the network?

Best regards,

Dias

0 Kudos