Zigbee Task with KW41Z

cancel
Showing results for 
Search instead for 
Did you mean: 

Zigbee Task with KW41Z

805 Views
alejandrovelez
Contributor III

Hello,

I have this function, in the End Device SDK Example of MCUXpresso, to send a dummy write attribute command to a custom attributes arleady created in another node in the network with that Short Address:

BDB_teStatus APP_sendData(bool bWriteAttResponse){
    BDB_teStatus eStatus;
    if ((sNodeState.eNodeState == E_RUNNING) && (bFailToJoinNode == FALSE))
    {
        tsZCL_Address          sAddress;
        sAddress.eAddressMode                      =  E_ZCL_AM_SHORT;
        sAddress.uAddress.u16DestinationAddress    =  0xAED9;

        uint16    u16ClusterId = 0x0b04;
        uint16    u16ManId = 0x1037;
        uint8      u8SourceEndpoint = 1;
        uint8      u8DestEndpoint = 1;
        uint8      bServerToClient = FALSE;
        uint8      u8SeqNum;
        uint8      bManSpecific = TRUE;
        uint8      u8NumbAttributes = 2;
        uint8      u8ZCLPayload1[] = {0x12, 0x34};
        uint8      u8ZCLPayload2[] = {0x56, 0x78};

        tsZCL_WriteAttributeRecord pu16AttributeRequestList[2];
        pu16AttributeRequestList[0].eAttributeDataType = E_ZCL_INT16;
        pu16AttributeRequestList[0].u16AttributeEnum = 0x0b00;
        pu16AttributeRequestList[0].pu8AttributeData = u8ZCLPayload1;
        pu16AttributeRequestList[1].eAttributeDataType = E_ZCL_INT16;
        pu16AttributeRequestList[1].u16AttributeEnum = 0x0a00;
        pu16AttributeRequestList[1].pu8AttributeData = u8ZCLPayload2;


        if(bWriteAttResponse){
            eStatus          =  eZCL_SendWriteAttributesRequest (u8SourceEndpoint,
                                                              u8DestEndpoint,
                                                              u16ClusterId,
                                                              bServerToClient,
                                                              &sAddress,
                                                              &u8SeqNum,
                                                              u8NumbAttributes,
                                                              bManSpecific,
                                                              u16ManId,
                                                              pu16AttributeRequestList);
        }else{
            eStatus          =  eZCL_SendWriteAttributesNoResponseRequest (u8SourceEndpoint,
                                                              u8DestEndpoint,
                                                              u16ClusterId,
                                                              bServerToClient,
                                                              &sAddress,
                                                              &u8SeqNum,
                                                              u8NumbAttributes,
                                                              bManSpecific,
                                                              u16ManId,
                                                              pu16AttributeRequestList);
        }
    }else{

    }
    return eStatus;
}

It works fine when I call the function from the button pressed case in the end device task:

pastedImage_5.png

as sniffer tool shows:

pastedImage_3.png

But if i send the same command from my custom task:

Creating the taks:

pastedImage_6.png

Sending from the Custom Task:

pastedImage_7.png

It doesn't work anymore and event triggers the watchdog.

What am I missing or which is the correct way to do this??

Thanks

Labels (2)
0 Kudos
5 Replies

608 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alejandro,

Why do you have a for loop? It is a big delay, did you try to enable that specific cluster?

I am assuming that your custom, you could create an event in the code that sends the data that you want.

Regards,

Mario

0 Kudos

608 Views
alejandrovelez
Contributor III

Hi Mario,

Thanks for your replay,

The loop is just for testing right now.

What I'm try to do is get the data from a sensor, that I allready have working, send the data to specific cluster, that It's allready created too, put to sleep the end device for some specific time, say  one minute or five minutes, then wake up and repeat the clycle, so that's the way i'm starting and really want to know the best way to achieve it. The cluster part is allready working when the event is from a pressed button, but I need a timer event.

Regards

0 Kudos

608 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alejandro,

Instead of the time event, you could bind your devices, at the beginning the end device will set up the binding endpoints that you want. In other words, the end device will report to his parents for any change or every specific time.

https://www.nxp.com/docs/en/user-guide/JN-UG-3113.pdf 

2.6.2 Binding

Regards,

Mario

0 Kudos

608 Views
alejandrovelez
Contributor III

But i got this from ZigBee Cluster Library User Guide

pastedImage_1.png

How can I report manufacturer-specific attributes?

0 Kudos

608 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alejandro,

You are right, only the standard attributes can be reported. 

Regards,

Mario

0 Kudos