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.

CCS/LAUNCHXL-CC26X2R1: Create endpoints and send data

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: SYSCONFIG

Tool/software: Code Composer Studio

Hi, I am creating an application with SDK 3.3 for CC26x2R1, it has a coordinator and an end-device, I have a ZED based on zed_light with three active endpoints, two for LED control and one for temperature measurement, I have some questions.

1. How can I modify the LEDs/GPIO that act with the cluster changes of state on/off (0x0006)?

2. How can I send the temperature data periodically to the coordinator, that is, for example every 5 seconds?

3. How can I send personalized messages, for example s string, to the coordinator?

Thanks

  • Hi Jose,

    I suggest that you review these Zigbee SLAs:

    http://dev.ti.com/tirex/explore/node?node=AHfY0Eko1oL507RS1aRYoQ__pTTHBmu__LATEST&r=pTTHBmu__ 
    http://dev.ti.com/tirex/explore/node?node=AJeGnyIqlkquNAYMtLtovQ__pTTHBmu__LATEST&r=pTTHBmu__ 

    1. The zcl_samplelight application files demonstrate ZCL callbacks and LED state updates
    2. Reference the zcl_sampletemperature application files for BDB_REPORTING, also the Zigbee Fundamentals SLA
    3. Zstackapi_AfDataReq as discussed in the Zigbee Fundamentals SLA

    Regards,
    Ryan

  • I followed the example of ZCL callbacks and the endpoints seem to be fine, but in the OnOffCB function, I still can't turn on the red LED of LAUNCHPAD and I don't know what could be wrong, this is the code I have

    static void zclGenericApp_OnOffCB( uint8_t cmd )

    {
    afIncomingMSGPacket_t *pPtr = zcl_getRawAFMsg();

    uint8_t OnOff = 0xFE; // initialize to invalid

    zclGenericApp_DstAddr.addr.shortAddr = pPtr->srcAddr.addr.shortAddr;

    // Turn on the light
    if ( cmd == COMMAND_ON )
    {
    OnOff = LIGHT_ON;
    LED_setOn(CONFIG_LED_RED, 200);
    }
    // Turn off the light
    else if ( cmd == COMMAND_OFF )
    {
    OnOff = LIGHT_OFF;
    LED_setOff(CONFIG_LED_RED);
    }
    // Toggle the light
    else if ( cmd == COMMAND_TOGGLE )
    {
    {
    if (zclSampleLight_getOnOffAttribute() == LIGHT_ON)
    {
    OnOff = LIGHT_OFF;
    LED_setOn(CONFIG_LED_RED, 200);
    }
    else
    {
    OnOff = LIGHT_ON;
    LED_setOff(CONFIG_LED_RED);
    }
    }
    }

    zclSampleLight_updateOnOffAttribute(OnOff);

    }

  • First, I recommend placing a breakpoint during a debug session to see if this callback is properly registered and ever entered.  Next I suggest that you use the CUI functions (CUI_ledOn) for SDK v3.30 or greater, these are demonstrated in zclSampleLight_UpdateLedState.  The maximum brightness parameter for LED_setOn is 100 and CONFIG_LED_RED is not a proper LED_Handle.

    Regards,
    Ryan

  • My code already works to turn on the LEDs, effectively using the CUI_LedOn function, I have the doubt of what the Handle is for in the case of the LED and the functions included in CUI or is any handle always necessary for the management of LEDs/GPIO/I2C?

    Thanks

  • I don't understand your question, but if the LED functions are known to work then you should debug the callback as suggested.

    Regards,
    Ryan

  • The question was, what exactly is the function of the handler? I have another question, how can I detect a pin (GPIO) that detects rising and falling edges, similar to how CONFIG_BUTTON_RIGHT works, I currently have a pin configured with sysconfig and the option BOTH_EDGES, Active Low Pull Up, and Pull up resistors, but only one flank is detected, what is the best way to make that detection and how can i identify rising/falling edge? The code is the following

    CUI_retVal_t retVal = CUI_init(&params);
    CUI_clientParams_t clientParams;
    CUI_clientParamsInit(&clientParams);

    CUI_btnRequest_t btnRequest2;
    btnRequest2.index = CONFIG_CONTACT;
    btnRequest2.appCB = NULL;

    retVal2 = CUI_btnResourceRequest(gCuiHandle, &btnRequest2);
    if (CUI_SUCCESS != retVal2)
    while(1){};

    bool btnState2 = false;
    retVal2 = CUI_btnGetValue(gCuiHandle, CONFIG_CONTACT, &btnState2);
    if(!btnState)
    {
    }
    CUI_btnSetCb(gCuiHandle, CONFIG_CONTACT, appChangeKeyCB);

    if(_btn == CONFIG_CONTACT)
    {
    CUI_ledToggle(gCuiHandle, CONFIG_LED_RED);
    }
    else{
    //CUI_ledToggle(gCuiHandle, CONFIG_LED_RED);
    }
    if(_btn == CONFIG_BTN_RIGHT)
    {
    CUI_ledToggle(gCuiHandle, CONFIG_LED_RED);
    }

  • gCuiHandle is a valid client handle which maintains resources such as LEDs, BTNs, and UART.  Make sure you are using the correct Button_EventMask inside your zclSample[application]_processKey function.  For example, the default example projects only take action on a Button_EV_CLICKED which means the button was pressed and then released in a quick matter of time.  You can choose to create a GPIO callback outside of the CUI button context if desiring a different functionality.

    Regards,
    Ryan

  • What would be the correct mask to differentiate between the rising edge and the falling edge? Or is it better to use the GPIO callback?

  • I have not explored this too much, if Button_EV_PRESSED and/or Button_EV_RELEASED does not work then you will need to consider using GPIO callback.

    Regards,
    Ryan