Howto join live Zigbee 3.0 Light network

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

Howto join live Zigbee 3.0 Light network

2,912 Views
matthias_brand
Contributor I

Hello

I have a question similar to How and where to set default link keys? from w.ashcroft@washcroft.com and ZBPro Configuration JN-AN-1218 from @youpko.

I'm using JN-AN-1218 Zigbee 3.0 Light Bulb example (version 1008) with JN-SW-4170 (version 1840) on an JN5168 chip.

Build configuration is "make LIGHT=ExtendedColorLight JENNIC_CHIP_FAMILY=JN516x JENNIC_CHIP=JN5168 DR=DR1175 TRACE=1 GP_SUPPORT=1 GP_DEVICE=PROXY_BASIC TOUCHLINK=1".

All compiles fine, however I am unable to joing a live network (Philips Hue).

I tried following the usermanual "JN-AN-1218-ZigBee-3-0-Light-Bulbs.pdf" chapter "8.1 Touchlink Preconfigured Link Key".

However on follwing step 2 (Application override key)

#define BDB_APPLICATION_DEFINED_TL_MASTER_KEY

the build fails on linking.

Linking ../../ExtendedColorLight/Build/ExtendedColorLight_GpProxy_JN5168_DR1175.elf ...
/c/NXP/bstudio_nxp/sdk/Tools/ba-elf-ba2-r36379/bin/ba-elf-gcc -Wl,--gc-sections -Wl,-u_AppColdStart -Wl,-u_AppWarmStart -march=ba2 -mcpu=jn51xx -mredzone-size=4 -mbranch-cost=3 -fomit-frame-pointer -Os -fshort-enums -flto -nostartfiles -L../../../../sdk/JN-SW-4170/Chip/JN5168/Build -L../../../../sdk/JN-SW-4170/Chip/JN5168/Library -L../../../../sdk/JN-SW-4170/Platform/DK4/Library -L../../../../sdk/JN-SW-4170/Components/Library -Wl,--gc-sections -L../../../../sdk/JN-SW-4170/Stack/ZBPro/Build -Wl,--defsym=__stack_size=6500 -Wl,--defsym,__minimum_heap_size=2000 -TAppBuildZBPro.ld -L ../../../../sdk/JN-SW-4170/Stack/ZCL/Build/ -o ../../ExtendedColorLight/Build/ExtendedColorLight_GpProxy_JN5168_DR1175.elf -Wl,--start-group ../../ExtendedColorLight/Build/irq_JN516x.o ../../ExtendedColorLight/Build/portasm_JN516x.o ../../ExtendedColorLight/Build/port_JN516x.o ../../ExtendedColorLight/Build/app_main.o

...

../../ExtendedColorLight/Build/bdb_fb_target.o -lJPT_JN5168 -lZPSMAC_Mini_SOC_JN516x -lPWRM_JN516x -lZPSTSV_JN516x -lAES_SW_JN516x -lPDUM_JN516x -lZPSAPL_JN516x -lRandom_JN516x -lPDM_EEPROM_NO_RTOS_JN516x -lDBG_JN516x -lZPSGP_JN516x -lZPSIPAN_JN516x -lZPSNWK_JN516x -lRecal_JN516x -lMiniMac_JN516x -lMiniMacShim_JN516x -lMMAC_JN516x -lAes_JN516x -lHardwareApi_JN516x -lMicroSpecific_JN516x -lBoot_JN516x -lBoardLib_JN516x -lJPT_JN5168 -lm -Wl,--end-group -Wl,-Map,../../ExtendedColorLight/Build/ExtendedColorLight_GpProxy_JN5168_DR1175.map
../../ExtendedColorLight/Build/app_zps_link_keys.o (symbol from plugin): In function `au8DistributedLinkKey':
(.text+0x0): multiple definition of `sTLMasterKey'
../../ExtendedColorLight/Build/App_ExtendedColorLight.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [../../ExtendedColorLight/Build/ExtendedColorLight_GpProxy_JN5168_DR1175.elf] Error 1

I then went back to change it in bdb_link_keys.c as also describted in step 2.

It seems however that it has been moved to app_zps_link_key.c.

There I changed

PUBLIC PUBLIC tsReg128 sTLMasterKey = {...};

However I failed to joing the live network

* LIGHT NODE RESET *
***********************************************
APP: Entering APP_vInitResources()
APP: Initialising resources...
APP: Entering vBULB_Init()
APP: Entering APP_vInitialise()
APP_vInitialiseNode

Zll state 00 - E_STARTUP

Zll recovered state FACTORY_NEW
Capabilities 001f

R 255 G 227 B 139 L 254 Hue 0 Sat 0 X 24939 Y 24701 T 4065K M 2 On 1 OnTime 0 OffTime 0
Set a random pan
PDM: Segment 11 buffer wear count swap

Factory new start up

Zll state 00 - E_STARTUP
PDM: Capacity 13
PDM: Occupancy 50
APP: Entering BDB_vStart()
APP: BDB Event: 02
APP: BDB_eNsStartNwkSteering()
BDB: Disc on Ch 11 from 0x02108800
APP: Entering APP_vMainLoop()

R 255 G 200 B 85 L 254 Hue 28 Sat 169 X 27532 Y 26236 T 3333K M 2 On 1 OnTime 0 OffTime 0BDB: APP_vGenCallback [0 10]
BDB: vNsTryNwkJoin - index 0 of 1 Nwks
BDB: Try To join 4cb593ea00d8ddf3 on Ch 11
PDM: Segment 17 buffer wear count swap
APP: BDB Event: 01
BDB ZCL Event 6
PDM: Segment 11 buffer wear count swap
PDM: Segment 17 buffer wear count swap
PDM: Segment 11 buffer wear count swap
PDM: Segment 11 buffer wear count swap
BDB: APP_vGenCallback [0 8]
FailedToJoin sNwkJoinFailedEvent.u8Status=173 !!!
BDB: vNsTryNwkJoin - index 0 of 1 Nwks
BDB: Try To join 4cb593ea00d8ddf3 on Ch 11
APP: BDB Event: 01
PDM: Segment 11 buffer wear count swap
PDM: Segment 17 buffer wear count swap
PDM: Segment 11 buffer wear count swap
BDB: APP_vGenCallback [0 8]
FailedToJoin sNwkJoinFailedEvent.u8Status=173 !!!
BDB: vNsTryNwkJoin - index 0 of 1 Nwks
BDB: No suitable network! Continue Discovery
BDB: Disc on Ch 15 from 0x02108800
APP: BDB Event: 01
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 20 from 0x02108800
APP: BDB Event: 01
BDB ZCL Event 6
BDB: APP_vGenCallback [0 10]
BDB: Disc on Ch 25 from 0x02108800
APP: BDB Event: 01
BDB ZCL Event 6
BDB: APP_vGenCallback [0 10]
APP: BDB Event: 06
APP: BDB No Networks
APP: BDB No Networks -> Wait On 11
APP: BDB Event: 01
BDB ZCL Event 6

I followed up by also changing

PUBLIC uint8 au8DistributedLinkKey[16]  = {...};

to the ZLL Commissioning trust centre link key but behavior stays the same.

pastedImage_19.png

With "JN-AN-1171-ZigBee-LightLink-Demo" and "JN-SW-4168" everything works fine after changing

s_au8ZllLnkKeyArray[16] = { ... }

and

sMasterKey = { ... }

Any idea what I am doing wrong?

Is there something else that has to be changed to join a live network?

Labels (1)
Tags (2)
0 Kudos
10 Replies

141 Views
Larz
Contributor III

@Sebastian_Del_Rio Was setting the key BEFORE zps_eAplAfInit() indeed the problem?

0 Kudos

2,573 Views
matthias_brand
Contributor I

Hi Sebastian

I was now finally able to join the network.

It seems that there is a unfortunate error in the doucmentation.

Application Note JN-UG-3113 states in chapter 5.8.3 "Setting Up ZigBee Security":

zps_vAplSecSetInitialSecurityState(), which must be called before
zps_eAplAfInit() and zps_eAplZdoStartStack() - see Section 5.1.

However that does not work, keys are ignored on calling zps_eAplAfInit().

The keys have to be set AFTER zps_eAplAfInit()!

/* Initialise ZBPro stack */
ZPS_eAplAfInit();

ZPS_vAplSecSetInitialSecurityState(ZPS_ZDO_PRECONFIGURED_LINK_KEY, (uint8 *)&au8PhilipsLinkKey, 0x00, ZPS_APS_GLOBAL_LINK_KEY);

ZPS_vAplSecSetInitialSecurityState(ZPS_ZDO_DISTRIBUTED_LINK_KEY, (uint8 *)&au8DefaultTCLinkKey, 0x00, ZPS_APS_GLOBAL_LINK_KEY);

That took a frustrating amount of time...

Maybe you could cross check and fix the application note. ;-)

0 Kudos

2,573 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Matthias,

 

It's good to hear that you could join the network!

 

Thank you for your feedback, we will take a look at the document you referred to.

 

Please let me know if you have further issues.

 

Best regards,

Sebastian

0 Kudos

2,573 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Matthias,

 

Could you please let me know which device is functioning as the trust center of your network? I noticed you don't have a coordinator present in the network by checking your sniffer log.

 

Best regards,

Sebastian

0 Kudos

2,573 Views
matthias_brand
Contributor I

Hi Sebastian

0xF376 is responsible for allowing new devices into the network.

0 Kudos

2,573 Views
matthias_brand
Contributor I

Hi Sebastian

In the trace I see the "Permit Join Request" and the "Beacon Request", I also see the transmission of the "Transport Key". It seems that my JN5168 does not want to respond to that "Transport Key" transmission due to "FailedToJoin sNwkJoinFailedEvent.u8Status=173 !!!".

pastedImage_2.png

I am using ch 11 exclusively on all network nodes.

I hope you can open Google Drive Links. I also added a trace of different lamp with a JN5169 chip (Not my SW) inside for which pairing works.

pairing_jn5169_paulmann_successfull.pcapng

pairing_jn5168_own_failed.pcapng

Based on the traces in Wireshark I can see that the Zigbee Light Link Commissioning Key is used. Don't want to print it here, but you can find it on the web. For example here. *cough**

Btw. really delighted that you support me. :-)

0 Kudos

2,573 Views
matthias_brand
Contributor I

Hi Sebastian

Thanks for your response.

So what I want to do is to join an existing Philips Hue network.

  1. I start the pairing on the Bridge
  2. Switch on the JN5168 Chip and it's immediately found by the Bridge
  3. Bridge starts sending the Transport key.
  4. Based on my trace with wireshark I know that it is encrypted with "81 ...TOUCHLINK_CERTIFICATION_LINK_KEY"
  5. JN5168 receives it, but throws error FailedToJoin sNwkJoinFailedEvent.u8Status=173 !!!.

So somehow I am missing the correct place in the code to add this "81 ...TOUCHLINK_CERTIFICATION_LINK_KEY" key.

 

With "JN-AN-1171-ZigBee-LightLink-Demo" and "JN-SW-4168" everything works fine after changing.

s_au8ZllLnkKeyArray[16] = { 81 ...TOUCHLINK_CERTIFICATION_LINK_KEY }

Any idea what I am missing?

0 Kudos

2,573 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Matthias,

 

When allowing a device to join the network, you should see a Management permit join, and before that, a Beacon showing if there's space for new routers or end devices in the network.

 

Could you please let me know which channel are you using?

 

Is the method for network joining by using touchlink? Or is it by Install code or by using the ZigBee Alliance key?

 

Also, could you please attach the full sniffer log to your reply?

 

Best regards,

Sebastian

0 Kudos

2,573 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Matthias, I hope you're doing well!

 

Just to clarify, are you having trouble joining your device to a pre-existing network? Or is the issue directly with Touchlink?

 

If the issue is with touchlink, could you please check if the following definition was properly added to the zcl_options.h header file:

 

#define TL_SUPPORTED_KEYS ( TL_MASTER_KEY_MASK )

 

Then, the ZigBee-supplied key for Touchlink must be copied to the bdb_link_keys.c source file so it's available to all applications using the BDB component.

 

Please let me know if you need more information.

 

Best regards,

Sebastian

0 Kudos

2,573 Views
matthias_brand
Contributor I

Also I noticed that if I dump the sBDB key register the pu8DefaultTCLinkKey seems to be garbled at the beginning.

pu8DefaultTCLinkKey: 00 00 ff ff 5a 69 67 42 65 65 41 6c 6c 69 61 6e
pu8DistributedLinkKey: 81 ...TOUCHLINK_CERTIFICATION_LINK_KEY
pu8PreConfgLinkKey: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
pu8TouchLinkKey: 9f ...TOUCHLINK_CERTIFICATION_ENC_KEY

And the pu8TouchLinkKey is only set to the correct key if I override 

PUBLIC tsReg128 sTLCertKey = {0x9f....};

with it.

Also not sure if pu8PreConfgLinkKey is okay as it is.

0 Kudos