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.

Why call the function ZDOInitDeviche destroys network?

Other Parts Discussed in Thread: Z-STACK, CC2530

Hello everyone. I do not know whether at that forum I write (I apologize in advance for my English), in general, I have a problem. I learned about 80% of the code of the Z-stack HA  and 90% of all the documents located there. For I do not have any secrets about the work of the whole system was built, called the stack (by the way the processor, which I successfully mastering - сс2530), but there are 3 points of which I can not write a proper firmware, namely:

1)   ZDOInitDeviche (). Why after calling this function on the destination device begin to happen strange things (although, as described Z-Stack Sample Applications, this function should just run end device). More specifically, the device starts, but begins to overwhelm the NWK frame of type Data_Request, then restarts (Project details below).

2)  Where are the functions body of the type NLME_GetExtAddr () . Exactly where the most magical file nwk_util.c ? And where body of  nwk_event_loop ? I gathered all the files in one folder stack, launched search and did not find anything about these functions, except  "extern TYPE FUNCTION"...

3) Despite the fact that the bodies of the functions listed in paragraph 2 of nowhere, they work! I checked! How is it possible ???

Actually about my project. I'm trying to write firmware for cc2530 based on a sample Z-Stack Home 1.2.0\Projects\zstack\HomeAutomation\SampleSwitch\CC2530DB\SampleSwitch.eww.  As for the hardware (lights and buttons) - everything is simple and no questions asked. About how screwed to LOOP the event handler, and how to handle them - also no issues. How to configure end-point, clusters, descriptors - no questions. How do callback functions for each team an individual cluster - also all clear. But how right  to start the device - the million dollar question ??? 

Do you realize I have a problem with network layer

First, its functionality is hidden because some files can not be found. Second, all that is written about the launch of the documentation Z-Stack Sample Applications (page 3-4) NO JOB

I was able to run the device how end-device as follows:

1) Registered in the configuration in NV items (ALL DO RIGHT see last drawing)

2) Launch ZDOInitDeviche (see first drawing)

3) delete HOLD_AUTO_STAR preprocessor options

After the previous procedure, ustroysto was started, joined the coordinator, is recognized as end device (it was seen in the sniffer), and began a terrible! From the device to the coordinator became an endless stream of requests to go type of Data_Request. Then at some point the device reboots itself, and then the process was repeated and perepodklyualos...

I began to look for the cause of this behavior and found that the above-described horror begins after ZDApp_event_loop manager  intercepts an event  [ if ( events & SYS_EVENT_MSG ) ]  wherein the processor ZDApp_ProcessOSALMsg intercepts an event : 

case ZDO_NWK_JOIN_IND:
if ( ZG_BUILD_JOINING_TYPE && ZG_DEVICE_JOINING_TYPE ){

// this condition is satisfied
ZDApp_ProcessNetworkJoin(); // this function will be called
}
break;

Drip deeper does not make sense, because I'm so very deep in the stack. So what do I do with this?


Lastly, I want to ask  all do not give me advicetype of "reading anything", because i reading ALL DOCUMETS of Z-Stack HA, thanks in advance =).

  • It seems that your end device uses different SECURITY key to coordinator. When end device of Z-Stack get authentication fail, it will reboot.
  • I will soon check your hypothesis. But there is such a thing. I want my device to join the network and automatically get the keys from the coordinator. Ie I use this type of security where the coordinator distributes key. How do I change my configuration for this? It is already configured for this type of security or am I wrong?

  • When you enable Zigbee security in Z-Stack, it can be preconfig key or TC link key. For these two types, your device has to know the preconfig key or TC link key for authentication. So, you have to know what is the security type on coordinator and revise your end device accordingly.
  • I understand that you want me to say. But I can not figure out how to do it correctly. More precisely, in what order.
    Example, my coordinator have:
    uint8 key_pre [] = {0x39,0x30,0x65,0x63,0x6E,0x61,0x69,0x6C,0x6C,0x41,0x65,0x65,0x42,0x67,0x69,0x5A};
    uint8 key_enable[] = {0x00};
    uint8 security_mode[] = {0x01};
    uint8 tclk_mode[] = {0x01};
    And my End Device has the same settings.
    But it still does not work. The device starts, connects to the network, receives a command Association Response (Successful), and the command Transport Key, and then begins to many many times to send in network comand Data_request. I already broke my whole head in troubleshooting...
  • I see that you write these security setting to flash and call ZDOInitDeviche(). However, writing these data to flash doesn't mean it applies to Z-Stack. Your steps are strange to me. Why do you do this? There are standard example to enable SECURITY and I suggest you start from standard examples. After you are familiar with Z-Stack and Zigbee SECURITY, you can try to revise it.

  • So this is the whole point. I take a clean code C:\Texas Instruments\Z-Stack Home 1.2.0\Projects\zstack\HomeAutomation\SampleSwitch\CC2530DB (without my intervention). Do this :
    "A device will automatically start trying to form or join a network as part of the BSP power-up sequence. If the device should wait on a timer or other external event before joining, then HOLD_AUTO_START must be defined. In order to manually start the join process at a later time, invoke ZDOInitDevice()."
    And there is nothing, as long as I do not do those "strange behavior". And when I prescribe a strange configuration, the device connects to the network, and occurs, what happens.
  • Then, Why do you write those data to flash? Can you be more specific about what you want to achieve?
  • I'm trying to be correct in what I want to achieve, but it interferes with knowledge of English. In general, I want to run the target device to automatically connect to the network, that's all. These data, I decided to write to memory, because doing so MT interface within the firmware coordinator, when I run it as described in the CC2530ZNP Interface Specification (channel USB - UART ). I gutted the whole MT interface, which also have a coordinator and end device (it's part of the stack), and found out what was going on in the mind of the coordinator, when it starts. I did the same thing for my end device. As a result, it connects to the network, but then everything collapses.
  • If you want device to join network automatically after it starts, you only need to disable HOLD_AUTO_START.
  • It was the first thing I did, because it was written in the documentation. BUT IT DOES NOT WORK !!! The second thing I did:
    1)disable HOLD_AUTO_START.
    2) called ZDOInitDevice(0); after zclSampleSw_Init( taskID ). in file OSAL_SampleSw.c
    And it did not work.
    Then I got into the firmware of its coordinator works and find out how it is run. As a result, I wrote configuration (see figure), which is written to memory. And those two items add it :
    1)disable HOLD_AUTO_START.
    2) called configuration_my () before macTaskInit( taskID++ ). in file OSAL_SampleSw.c
    3) called ZDOInitDevice(0); after zclSampleSw_Init( taskID ). in file OSAL_SampleSw.c
    In resualt :
    void osalInitTasks( void )
    {
    uint8 taskID = 0;

    tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);
    osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt));

    configuration_my (); // I DO THIS

    macTaskInit( taskID++ );
    nwk_init( taskID++ );
    Hal_Init( taskID++ );
    #if defined( MT_TASK )
    MT_TaskInit( taskID++ );
    #endif
    APS_Init( taskID++ );
    #if defined ( ZIGBEE_FRAGMENTATION )
    APSF_Init( taskID++ );
    #endif
    ZDApp_Init( taskID++ );
    #if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
    ZDNwkMgr_Init( taskID++ );
    #endif
    zcl_Init( taskID++ );
    zclSampleSw_Init( taskID );

    ZDOInitDevice(0); // I DO THIS

    }

    And it worked, but not as much as I expected. The device reboots, 20 seconds after successfully connecting to the network.
  • Forget your step 2 and 3, they don't help. When you disable HOLD_AUTO_START and start end device, try to use Ubiqua Packet Analyzer to check over the air messages. You should see end device sending beacon requests and coordinator would response. Then, end device would send association request and coordinator would response association, ...etc.
  • Thank you for the advice, but it's past. I have a sniffer which shows me all packets passing through the network. And when I turn off HOLD_AUTO_START, my device does not send anything to the network (even beacons). When I do all 3 steps, i can see in sniffer how it is connected, the query goes beacons, then send the keys from the coordinator device (Transport key), then the device starts to send to the network of 10 packets Data Rquest per second. And it (Data Request) does not stop/
  • Anyway, it is good to know your problem is solved.
  • I did not understand. I solved problem? Or what? I say, goes endless stream of requests DATA REQUEST from my device to the network. It should not be, I know it, because other (Netvox) devices themselves do not lead ....
  • Data request is sent by ZED according to POLL_RATE setting. What do you mean other (Netvox) devices themselves do not lead…?
  • Definitely! POLL_RATE setting !!! As I just did not think =) There's also a whole bunch of settings =) I realized what my problem! It is necessary to register all the settings that are, not just the ones I ordered =) Thank you very much =)
  • You are welcome!