This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2650EMK: SampleDoorLock example infinite loop after Zigbee connection

Part Number: CC2650EMK
Other Parts Discussed in Thread: Z-STACK, CC2650, CC2538

Greetings,

I am trying to connect CC2650EM as an end device to a Zigbee network created by CC2538EM as a coordinator. I use the Sample Door Lock pair of examples from Z-Stack Home 1.2.2a.

I used the "SampleDoorLockController" example on CC2538EM and modified it to send "toggle" every 3 seconds (I raise an event every 3 seconds using osal_start_timerEx() function and handle it like an "up" switch is clicked). I debugged this code and it works fine.

I flashed "SampleDoorLock" example (without modifications) on CC2650EM. It successfully connects to the Zigbee network (it shows an address on the SmartRF06 LCD after a few seconds of powering on), but after that, nothing happens. When I debugged, I found that it enters an infinite loop in the next iteration after connecting to network. It waits for response message infinitely in line 1001 (dlsapp.c):

 

Why isn't it receiving any data? The network is established between the two devices and the coordinator is sending a message every 3 seconds. What makes the end device wait for infinite time?

Regards

* James *

  • Hi James,

    In the out of box example, the end device should be polling the coordinator every 2 seconds, this is configured by ZNWK_POLL_RATE in znwk_config.h. Do you have a sniffer log? You should see data requests sent out from the end device every 2 seconds.

    The "infinite loop" you've put your breakpoint on is behaving as intended, the device will block here and go into sleep mode until another message is received.
  • Thanks Jason.

    I don't really understand you, but your words raised some questions:

    1. Do you mean that my end device CC2650EM sends requests to its coordinator to look for messages? I thought the end device just waits till it receives a message from the coordinator.

    2. If so, then how could I check for this in the code since I don't have a sniffer and I tried to debug it but I didn't reach the part where it polls for something?

    3. If I changed the ZNWK_POLL_RATE to be 1 second as previous, will this have any effect or it just will still ignore messages from the coordinator?

    Regards
    * James *
  • 1. Yes, an end device needs to poll its parent in order to look for any buffered data. This is the main idea behind using an end device vs using a router. With a router, the receiver is always open which means it does not need to poll to receive data, but it also consumes much more power since it does not go into sleep mode. With an end device, it can only receive data after polling, but in between polls the end device can go into sleep mode.

    2. Did you perform EZ-Mode commissioning on both devices in order to bind matching clusters? You will not be able to send meaningful data between these devices otherwise.

    3. Messages will be buffered in the coordinator for up to 7 seconds (NWK_INDIRECT_MSG_TIMEOUT), so changing the poll rate from 2 to 1 second should not make a difference, other than speeding up the poll rate obviously.
  • That's great Jason, I wasn't aware that it keeps polling.

    2. I don't really know if it is or not, I just used the code in the example unmodified in the part of EZ mode. but now that you mentioned it I got the Z-stack developer's guide and z-stacks home developers guide and read the parts of EZ mode. I think you are right but I checked for CC2650 and found that "ZCL_EZMODE" is defined (which I think means that it EZ mode is on, please correct me if I am wrong about it) , could you guide me where could I check this option?

    Thanks in advance
  • Using 2x SmartRF06 with a CC2538EM doorlockcontroller coordinator and a CC2650EM doorlock end device, I did the following:

    > (both devices off, NV cleared, factory reset, etc)
    > turn on the CC2538, let it automatically create a network (LCD will display network information after formation)
    > press SW2 on the CC2538 board, which starts EZ mode commissioning
    > turn on the CC2650, press SW2 which starts network joining + EZ mode commissioning
    > a few seconds after joining, both LCDs on line 2 should say "EZMode: Success" if it worked correctly
    > you can now send commands from controller to door lock, like door lock toggle.
  • Thanks a lot Jason, It worked like magic!

    Regards
    James