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.

CC2530: Issue with NLME_LEAVE_REQUEST..

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hi.

I have 4 routers and 1 coordinator to test. I am sending the NLME_LEAVE_REQUEST to the "router 1" and it is leaving form the network. 

Again it will connect with the same network if there is no other coordinator to join. 

After joining, I am sending the Leave_Request to the "router 1" and it's leaving the joins into the network. This steps remains same for all the routers. 

But router is not leaving the network If I am sending the leave_request continuously after joining the router into the network. I am getting error as INVALID_REQUEST.

The error is


<TX>11:31:56.29 COM9 NLME_LEAVE_REQUEST (0x2305)
DeviceAddress: 0x00124B0009E9A4C1
RemoveChildren: TRUE (0x1)
Reassociate: FALSE (0x0)

<RX>11:31:56.3 COM9 NLME_LEAVE_RESPONSE (0x6305)
Status: ZNWK_INVALID_REQUEST (0xC2)

 

For the first two times I am not facing this issue. If I am sending continuously means this error occurs. But I am getting ON/OFF status.

Is there any problem with stack, because after 2 or 3 times of sending LEAVE_REQUEST, I am getting this error.

I have list in cloud so that the devices in the list only will be present in the network. Other devices will be asked to leave by sending NLME_LEAVE_REQUEST. So the devices which is not in the list will receive Leave request.  Because of the above issue, it is not leaving the network and While doing ON/OFF the router I am getting 00:00:00:00..... as MAC. 

In Z-tool also the response is same.

How to fix this...

 

  • Hi Arun, 

    What Z-Stack are you using? 

    I have had trouble in the past with this command, and I don't normally use it anymore.

    Why not try the following:

    Write a procedure that writes the default config in the NV memory, and then restart the device. This will have the same effect as making the device leave the network. 

    These functions will default the NV memory:

    zgWriteStartupOptions( ZG_STARTUP_SET, ZCD_STARTOPT_DEFAULT_CONFIG_STATE ); 
    zgWriteStartupOptions( ZG_STARTUP_SET, ZCD_STARTOPT_DEFAULT_NETWORK_STATE );

    Use the function SystemReset() or HAL_SYSTEM_RESART to restart the device.

    And obviously, make sure that permit-join is disabled on all devices: NLME_PermitJoiningRequest( 0 );+

    Hope this helps

  • Thanks for you reply Dan O'connell.

    Version of the stack I am using is Zstack1.2.2 . If permit joining is disabled means how the devices will connect with coordinator.

    And what is the purpose configuring default config.
  • Ok, as far as I know, that version is relatively recent, so they might have made the leave command work properly. Wait for someone else to reply who knows more about it.

    Yes, the function NLME_PermitJoiningRequest( ) controls the joining of all devices. If you pass a 0, joining is disabled. Any other value is the number of seconds that you want to allow joining for. 0xFF will enable joining permanently. Note that you can use this command on a router to allow a device to join via that router.

    The default config refers to the settings that a device uses when it starts from reset and then sees that there is no data in the related NV memory, like when it has not joined a network before. It then uses settings to make it find a network and try join it.

    Did the procedure that I used make sense? Else I will send it to you here.
  • You can disable NV_RESTORE in compile options, so that router won't have any information after power reset.

    Do you have any other solution?
  • Good point, but the device would have the same effect: If NV_RESTORE is disabled, then when the above mentioned config functions are called, they won't have any effect, but the device will still restart, and as long as join is disabled on the coordinator and other routers, no devices will be able to join.
  • I don't know of any other solutions.

    Did my first reply make sense? To write the procedure that makes a device default its config and then restart?