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.

Z-stack Home 1.2.2 HA profile Light Toggling

Other Parts Discussed in Thread: Z-STACK

Which file i can get port & pin configuration of led connected in light project for toggling,on and off process under home automation in z-stack home 1.2.2?

  • Do you receive this on SampleTemperatureSensor side or receiver side?
  • thermostat side.every 10 sec breakpoint at if ( *msgPtr == AF_INCOMING_MSG_CMD ) of zcl_event_loop is hit. i have defined MT_AF_FUNC & MT_AF_CB_FUNC but i don't receive AF_INCOMING_MSG MT response. in stead i get that response
  • Try to add the following red line in zcl_event_loop().

          if ( *msgPtr == AF_INCOMING_MSG_CMD )
          {
            zcl_ProcessMessageMSG( (afIncomingMSGPacket_t *)msgPtr );

            osal_msg_send( zclYourApplicaiton_TaskID, msgPtr );
          }

    And you should receive AF_INCOMING_MSG_CMD.

  • I have revised with following lines then also same MT responses are coming not AF_INCOMING_MSG MT response.
    if ( *msgPtr == AF_INCOMING_MSG_CMD )
    {
    zcl_ProcessMessageMSG( (afIncomingMSGPacket_t *)msgPtr );
    osal_msg_send( zclSampleThermostat_TaskID, msgPtr );
    }
    Will continue tomorrow. Thanks
  • Hi Yikai,
    What i need to do for receiving AF_INCOMING_MSG_CMD through hyper terminal? end device annce,active EP response,simple desc response are received correctly.
    To confirm whether those packets are received from temperature sensor, i had disabled osal_start_timerEx( zclSampleTemperatureSensor_TaskID, SAMPLETEMPERATURESENSOR_TEMP_SEND_EVT, SAMPLETEMPERATURESENSOR_REPORT_INTERVAL ); at temperature sensor end and those packets were not received at thermostat end.
    Every 10sec i receive following two packets.
    FE 1A 48 80 5A 43 3A 20 45 37 36 44 20 31 31 20 30 30 30 30 20 54 45 4D 50 3A 20 32 33 43 A5
    FE 21 48 80 5A 43 3A 20 45 37 36 44 20 31 31 20 30 30 30 30 20 53 57 35 3A 20 48 65 6C 70 20 20 20 20 20 20 20 F0
  • You have to define MT_AF_FUNC and MT_AF_CB_FUNC to receive AF_INCOMING_MSG_CMD through hyper terminal.

  • Hi Yikai,
    I had already defined MT_AF_FUNC and MT_AF_CB_FUNC as i had told you in my earlier post. I have tried implementing same thing in door lock(ZED) and door lock controller(ZC). zed is sending door status every 10sec. data is received at zc(breakpoint hit) but there is no any data receive response in hyper terminal. In this case those unknown response are not received. I have defined following preprocessors.
    ZTOOL_P1,MT_TASK, MT_APP_FUNC,MT_SYS_FUNC,MT_ZDO_FUNC,MT_ZDO_CB_FUNC,MT_AF_FUNC,
    MT_AF_CB_FUNC,MT_NWK_FUNC,MT_NWK_CB_FUNC,MT_ZDO_MGMT. As i am able to receive end device annce,EP response,simple desc response so there should not be problem with uart..
  • Do you add the following red line in zcl_event_loop()?

          if ( *msgPtr == AF_INCOMING_MSG_CMD )
          {
            zcl_ProcessMessageMSG( (afIncomingMSGPacket_t *)msgPtr );

            osal_msg_send( zclYourApplicaiton_TaskID, msgPtr );
          }

  • Ya already added as told before. osal_msg_send( zclSampleDoorLockController_TaskID, msgPtr );(zc is door lock controller)
  • If possible, Can you please tell which function will send the received value from sensor to the hyper terminal. I will check whether that function is called or not and if its called, what value it retains for sending data through hyper terminal.
  • Try to revise red part to your sampleDoorLockController_TestEp and test again.

    // Test Endpoint to allow SYS_APP_MSGs
    static endPointDesc_t sampleDoorLockController_TestEp =
    {
      SAMPLEDOORLOCKCONTROLLER_ENDPOINT,                                 // Test endpoint
      &MT_TaskID,
      (SimpleDescriptionFormat_t *)NULL,  // No Simple description for this test endpoint
      (afNetworkLatencyReq_t)0            // No Network Latency req
    };

  • Now also No data received through hyper terminal except end device annce. breakpoint at if ( *msgPtr == AF_INCOMING_MSG_CMD )
    {
    zcl_ProcessMessageMSG( (afIncomingMSGPacket_t *)msgPtr );
    osal_msg_send( zclSampleDoorLockController_TaskID, msgPtr ); //also tried by replacing here
    //zclSampleDoorLockController_TaskID with MT_TaskID
    }
    is hit every 10sec.
    I have modified a little only in original z-stack like made unicast destination addressing at zed for sending data and at zc what you have told to modify. Except these i have not modified anything at both zed and zc. Don't know why its not sending data to hyper terminal.
  • Try to use MT command AF_REGISTER to register endpoint from Ztool.
  • AF_REGISTER shows status as 184(0xB8)
  • Here are my transmit sequence and receive response. receiving data through uart is soul of my application. if it doesn't work then i can't do anything in my applicaion. i have tried with different sample applications of original z-stack 1.2.2 and also tried with z-stack version 1.2.1 sample application but same result i.e. no data received.

     

  • I don't know what's wrong with your test now. If you don't have to use DoorLock controller as coordinator, I would like to suggest you to use ZNP with ZTool to setup coordinator.
  • My coordinator can be anything but it should be able to communicate with different clusters like temperature,door lock,presence,IAS,energy measurement etc,send and receive data through uart(i am not using z-tool in my application). Will ZNP handle with all these clusters? I don't know more about ZNP.
  • sorry. coordinator should transmit all received data through uart to hyper terminal and it should transmit data received from hyper terminal to the end devices through air belonging to different clusters as specified earlier.
  • Of course, ZNP can do it. Please also refer to Z-Stack ZNP Interface Specification.pdf in API document folder. You can download script ZNP_script_example.7z from TheDarkSide's reply at e2e.ti.com/.../1208179 to start coordinator from Ztool by script.
  • Can you please re-send TheDarkSide's reply link? that link shows runtime error.
  • Thanks for giving me this valuable idea. Will look into it in details in the pdf and find way if i can develop my application based on this.
  • You are welcome.
  • Hi Yikai,
    I had studied few topics of ZNP sample applications(SWRU242). As far as i understood, it needs extra MCU(like MSP430) to act as ZAP. In my application CC2530 will be directly interfaced with android box through uart and hence there is no such possibility of using extra MCU to act as ZAP. i have implemented basic MT commands functionalities(like device annce,EP req&res etc) in android app which communicates with cc2530(coordinator) through uart. Is it possible to use ZNP approach for my coordinator without disturbing this hardware set up?
  • Actually, ZAP can be run on any MCU. There is no problem to make ZAP running on Android. Since Android is based on Linux, you can try to refer to TI Zigbee Home Automation Gateway reference design at www.ti.com/.../CC2531EM-IOT-HOME-GATEWAY-RD
  • Although i am not able to clearly understand how to implement ZAP,I think as of now i can't use this ZAP-ZNP approach as it will take lots of time to research on its functionality. For now its not possible for me to change the current hardware approach and android app i am using. All my functionalities are working using simple app of z-stack home 2.5.1a. Only thing i want to do is make my devices HA compliant so that it can work with 3rd party devices and hence want to use z-stack 1.2.2. If its possible to implement only ZNP approach(for receiving and sending data over air) on my coordinator and transmit these data through uart(to and from android box) then i can try to do that.
  • Maybe it is not a good idea to change your current project to use ZNP since you already have some progress on it. Try to debug into it and find where the problem is.
  • If possible can you please check or if you would have tried earlier whether AF_INCOMING_MSG response is received at hyperterminal. I have tried several sample projects but couldn't get it. I am not able to think where there is problem because i am able to get other MT command response.
  • Hi Yikai,

    I am debugging for not receiving data through uart. Can you please tell about the comments in the included image file.

  • I had tried commenting the lines marked yellow. After commenting these lines AF_INCOMING_MSG response is received in hyper terminal. Can you please tell what's wrong with these commented lines?

  • MT command is in hex format. Why do you try to receive it in hyper terminal? Why don't you check it in ZTool?
  • After commenting those lines only i am able to receive AF_INCOMING_MSG response in both Z-tool and hyper terminal. before i was not getting in either of two. i am testing with hyper terminal because my application in android receives data in hex format only. what's wrong with those commented lines?
  • I had added following lines
    epDesc->task_id = &MT_TaskID;
    before calling
    afBuildMSGIncoming( aff, epDesc, SrcAddress, SrcPanId, sig,nwkSeqNum, SecurityUse, timestamp, radius );
    in
    void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 SrcPanId,
    NLDE_Signal_t *sig, uint8 nwkSeqNum, uint8 SecurityUse,
    uint32 timestamp, uint8 radius )
    and uncommented those lines and now i am able to receive data in z-tool and hyperterminal.
    Will it affect any thing else?
  • I had done this before and pretty sure it work. Don't know why it doesn't work in your test. I would like to suggest you to start the test over again. Reinstall Z-Stack and add the following red line in zcl_event_loop().

    if ( *msgPtr == AF_INCOMING_MSG_CMD )
    {
    zcl_ProcessMessageMSG( (afIncomingMSGPacket_t *)msgPtr );

    osal_msg_send( zclYourApplicaiton_TaskID, msgPtr );
    }


    Check if you receive AF_INCOMING_MSG_CMD in your zclYourApplication_event_loop() first.
  • My problem is solved now. I had made changes as described in the document. Dono why these changes are not done in z-stack.Changes made for AF_INCOMING_MSG response.docx

  • Anyway, it is good to know you have made it worked.
  • You had told to revise following marked code. Will it not affect other operations?

  • By changing the taskID to MT_TashID, It would process the message sent to sampleDoorLockController_TestEp by MT process. Since I see no one use sampleDoorLockController_TestEp in sampleDoorLockController, I don't see it would affect other operation.
  • Hi Yikai,
    From your previous reply, I hope the three changes i had made(as described in the document) for receiving AF_INCOMING_MSG response through uart should not affect other operations.

    Here i have included two files for receiving data AF_INCOMING_MSG response. One file shows data received in hyper terminal and other shows data received in z-tool. Since its impossible to receive data simultaneously in z-tool and hyper terminal, so some bytes received may differ in both files.
    As you can see len field of AF_INCOMING in hyper terminal shows 8 bytes but actual data received is 11bytes. z-tool shows correct reception of 8bytes only.It may be due to z-tool only shows data based on len field.

    My question is where there may be possibility for adding extra three bytes(8(len)+3=11) than the specified len of data?
  • 1. I don't see any file included in your post.
    2. simultaneously in z-tool and hyper terminal? How do you do this?
  • Sorry, i forgot to include the files.

    I didn't mention simultaneous reception in z-tool and hyper terminal but i said its impossible to receive simultaneously. Closing the COM port in one and and opening in other i am doing one by one1488.data.rar.

  • From MT command format, the data is 8 bytes and the byte data 0x28 after the 8 bytes of data is FCS. However, I don't know where the other bytes are from. I think it doesn't matter. You can just skip it.
  • 0x28 is not FCS but last byte is FCS. I had resetted the nwk and then checked again. what i find is SrcAddr gets repeated in the extra three bytes. i have included the response and you can find that beside SrcAddr one byte 0x1D is common in both of these response. Don't know why SrcAddr gets repeated again and where this extra byte 0x1D comes from.

  • Can you show me how you send this packet?
  • I am sending data through function defined for sending temperature in original z-stack. Just modified pReportCmd->attrList[0].attrData = 0; for testing AFINCOMING_MSG.

    zclSampleTemperatureSensor_DstAddr.addrMode = Addr16Bit;

    zclSampleTemperatureSensor_DstAddr.endPoint = SAMPLETHERMOSTAT_ENDPOINT;

    zclSampleTemperatureSensor_DstAddr.addr.shortAddr = 0;

  • Can you also provide sniffer log for this message?
  • Sniffer log for data received 8512.a.psd

  • After I check the sniffer log, I don't see temperature report. There is only DoorLock report attribute. I think there must be something wrong with your code. I don't think the message is sent by the source code that you posted in previous reply.

  • I think i had downloaded wrong program in zed. i will download code again and take a fresh test. As far as remember, my door lock status sending code and temperature sending code are identical. i mean i had copied same temperature sending function to send door lock status every 10sec. what ever may be the code MT command should work as its expected. Any way i will take a fresh test and see if same problem exists.
  • Yes, please do the test again. By the way, I would suggest you to create another thread for new issue if you have any. This thread goes too erratic now.