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: CC2530 always sent ZCL Attributes response as ON

Part Number: CC2530

Hi Guys,

I am continue to design my device. I am grateful to Mr Yikai. 

My ZCL cluster on/off (0x0006), in HA profile, command almost running well.... I do not know what's happening, always my device reports via ZCL Command: Read Attributes Response. the value on (0x01) 

You can see bellow that independent of the ZCL command ( on or off) always the response to ZCL read attributes is always on ( 0x01).

In this PIC you can see that after ZCL CMD OFF, the response from Read Attribute still ON.

  • When your device receives OFF command, do you change ON/OFF attribute to 0?
  • Mr Yikai,
    I need to define it: zclSampleLight_Attrs =0; ???

    My ZCL onoffCB is:

    static void zclSampleLight_OnOffCB( uint8 cmd )
    {
    // Turn on the light
    if ( cmd == COMMAND_ON )
    zclSampleLight_OnOff = LIGHT_ON;

    // Turn off the light
    else if ( cmd == COMMAND_OFF )
    zclSampleLight_OnOff = LIGHT_OFF;

    // Toggle the light
    else
    {
    if ( zclSampleLight_OnOff == LIGHT_OFF )
    zclSampleLight_OnOff = LIGHT_ON;
    else
    zclSampleLight_OnOff = LIGHT_OFF;
    }
  • No, you only have to change zclSampleLight_OnOff value.
  • Hi Mr Yikai.
    I changed but continue the ZCL Read Attributes response (sent by my device) status record as 0x01 (ON).

    I changed in the ZCL zclSampleLight_OnOffCB as you told me, as you can see bellow, but it´s still not working. Please, Would you help me?

    static void zclSampleLight_OnOffCB( uint8 cmd )
    {
    // Turn on the light
    if ( cmd == COMMAND_ON )
    { zclSampleLight_OnOff = LIGHT_ON;
    HalLedSet( HAL_LED_3, HAL_LED_MODE_ON ); // Written by ASA
    }
    // Turn off the light
    else if ( cmd == COMMAND_OFF )
    zclSampleLight_OnOff = LIGHT_OFF;

    // Toggle the light
    else
    {
    if ( zclSampleLight_OnOff == LIGHT_OFF )
    zclSampleLight_OnOff = LIGHT_OFF; // written ASA forced as off
    else
    zclSampleLight_OnOff = LIGHT_OFF; // wirtten ASA forced as off
    }

    // In this sample app, we use LED3 to simulate the Light
    if ( zclSampleLight_OnOff == LIGHT_ON ) {
    HalLedSet( HAL_LED_3, HAL_LED_MODE_ON );
    HalLedSet( HAL_LED_1, HAL_LED_MODE_OFF );
    }
    else {
    HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF );
    HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
    }
    }
  • I suggest you to debug with IAR, stop the program and check zclSampleLight_OnOff in watch window when you do a attribute read.
  • Hi Mr Yikai, right now my device sent ZCL Read Attributes response correctly.
    I made the debugging and I discovered that I have a mistake to define one input error on Cluster ID attributes definition.

    I used incorrect ID ZCL_CLUSTER_ID_GEN_ON_OFF when the correct Cluster ID is: ZCL_CLUSTER_ID_GEN_BASIC.

    Would you see the correct code part bellow:

    ZCL_CLUSTER_ID_GEN_BASIC, //
    { // Attribute record
    ATTRID_BASIC_ZCL_VERSION,
    ZCL_DATATYPE_UINT8,
    ACCESS_CONTROL_READ,
    (void *)&zclSampleLight_ZCLVersion

    Thanks a lot for your assistance.
    BR
    Alex
  • I couldn't understand what you want me to check for you. Please elaborate.
  • Hi Mr Yikai, You don't need to check!
    afetar I changed the ZCL claster parameter that I wrote in my last post, my device starting to running well!

    Thanks for you assistance.
    BR
    Alex