This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thermostat cluster enable issue

Hi All,

I am developing product using nRF52840 and SDK nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71.

This product is basically, using the Thermostat cluster and Zigbee protocol to communicate with the Zigbee gateway.

So, I referred light_bulb example and followed steps to enable "Thermostat cluster and attributes".

I have included the respective files also but I am unable to execute the below callback function case statement,

static zb_void_t zcl_device_cb(zb_uint8_t param)
{
    zb_uint8_t                       cluster_id;
    zb_uint8_t                       attr_id;
    zb_buf_t                       * p_buffer = ZB_BUF_FROM_REF(param);
    zb_zcl_device_callback_param_t * p_device_cb_param =
                     ZB_GET_BUF_PARAM(p_buffer, zb_zcl_device_callback_param_t);

    NRF_LOG_INFO("zcl_device_cb id %hd", p_device_cb_param->device_cb_id);

    /* Set default response value. */
    p_device_cb_param->status = RET_OK;

    switch (p_device_cb_param->device_cb_id)
    {
        case ZB_ZCL_SET_ATTR_VALUE_CB_ID:
            cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;
            attr_id    = p_device_cb_param->cb_param.set_attr_value_param.attr_id;

            if (cluster_id == ZB_ZCL_CLUSTER_ID_THERMOSTAT)
            {
                uint16_t value = p_device_cb_param->cb_param.set_attr_value_param.values.data16;

                NRF_LOG_INFO("thermostat local temperature: %d", value);
                if (attr_id == ZB_ZCL_ATTR_THERMOSTAT_LOCAL_TEMPERATURE_ID)
                {
                    local_temperature_value(value);
                }
            }
            else
            {
                /* Other clusters can be processed here */
                NRF_LOG_INFO("Unhandled cluster attribute id: %d", cluster_id);
            }
        break;

        default:
            p_device_cb_param->status = RET_ERROR;
            break;
    }

    NRF_LOG_INFO("zcl_device_cb status: %hd", p_device_cb_param->status);
}

Also, I am attaching code for reference please let me know what else I forgot to enable the functions. It is urgent for me to solve this issue.

Radiator_nRF_v0.9.0.zip

And, with these attributes, for some of the commands, I need to implement custom attributes so if you share how to add custom attributes to this cluster.

Thanks in advance.

Regards,

Rohit R

  • Hi Marte, 

    Any update from developer? I need urgent help. 

    And, how to enable this below configuration 

    "ION_RAMOFF_EVENT System ON, no RAM retention, wake on any event 0.97 μA" typically. 

    can you explain me the configuration for same. 

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    Due to summer vacation you might have to expect some increase in response time, also from our developers.

    As for current consumption, you will notice a significant increase in current consumption when not using Sleepy End Device (SED) compared to a device with SED enabled. This is because with other low power modes, the radio is still always on, causing a much higher current consumption than if it is off. With SED the other hand, the radio will be off when it sleeps. However, this will make it so that the device will not be able to receive messages at all times, and cannot wake up by a command from another device, as it will not receive the message when it is sleeping. So you will have to either use SED and have the radio off at times, or you will have to have a higher current consumption. A device implemented as a SED will wake up periodically to check for messages, as I have explained earlier. It will do this by polling it's parent and asking the parent if there are any messages for it, as the parent store the messages for some time so that the SED will receive them on wake up. You can change the poll interval with zb_zdo_pim_set_long_poll_interval, to make the sleepy end device poll it's parent at a shorter interval than the default one.

    Rohit Rajapure said:
    Can we use in SDK 3.0 ? If yes the How to handle it in helper.c file or any other file. 

     The best option would be to use SDK 4.1.0 instead, but since that is not an option, you can try to add the function zigbee_power_down_unused_ram to your project yourself, as the implementation of the function is available in v4.1.0, and not an internal stack function. To do this, you must add the function to your SDK, as well as any dependencies of that function. I cannot guarantee that it will work, as there might be other changes between v3.0.0 and v4.1.0 affecting this, but it should be possible to power down the unused RAM in v3.0.0 as well.

    Rohit Rajapure said:
    "ION_RAMOFF_EVENT System ON, no RAM retention, wake on any event 0.97 μA" typically. 

     This mode and current is for the base current consumption of the chip in ON idle mode.

    • System ON: This means that the chip is in system ON, and not in system OFF, which means that the chip is in a regular state ready to run, and that the CPU is in sleep mode. The CPU is in a WFE (waitinf for event) call, and will wake when there is an interrupt. This interrupt is typically the RTC clock, but with 1 μA. the RTC is not in use.
    • no RAM retention: this means that the RAM is not conserved, and will practically mean that there is no code running on the chip.

    So you will not be able to get this current consumption and still run your application on your device. You will minimally need RAM retention, RTC to wake up at intervals, and the LF clock, which is needed for RTC. Therefore, your current consumption will be above 1 μA, even if you are using SED and powering down RAM sections. According to the specification, the expected current consumption with RAM retention and RTC is as follows:

    ION_RAMON_RTC
    System ON, full 256 kB RAM retention, wake on RTC (running from LFRC clock)
    3.16 
    µA

     However, since you are able to power down unused parts of RAM, you will not have full 256 RAM retention, which will reduce current compared to the above. Additionally, you can use LFXO as a clock source instead of LFRC, and use an external crystal, which will have slightly lower current consumption than using LFRC.

    Best regards,

    Marte

  • Hi Marte, 

    Thank you so much for response, 

    Due to summer vacation you might have to expect some increase in response time, also from our developers.

    - Okay, i will wait but need help.

    As for current consumption, you will notice a significant increase in current consumption when not using Sleepy End Device (SED) compared to a device with SED enabled. This is because with other low power modes, the radio is still always on, causing a much higher current consumption than if it is off. With SED the other hand, the radio will be off when it sleeps. However, this will make it so that the device will not be able to receive messages at all times, and cannot wake up by a command from another device, as it will not receive the message when it is sleeping. So you will have to either use SED and have the radio off at times, or you will have to have a higher current consumption. A device implemented as a SED will wake up periodically to check for messages, as I have explained earlier.

    - Okay, If I configure as SED. It will give comparatively less current than getting now correct?

    - And, If I just call sleep now () in zigbee_signal_handler means it is configured as SED. And I can comment this part from code to make SED? Correct? 

    zb_void_t zb_osif_go_idle(zb_void_t)
    {
    //TODO: implement your own logic if needed
    zb_osif_wait_for_event();
    }

    - And, in SED device wake up every 10sec correct? I read in one of the nordic link. 

    The best option would be to use SDK 4.1.0 instead, but since that is not an option, you can try to add the function zigbee_power_down_unused_ram to your project yourself, as the implementation of the function is available in v4.1.0, and not an internal stack function. To do this, you must add the function to your SDK, as well as any dependencies of that function. I cannot guarantee that it will work, as there might be other changes between v3.0.0 and v4.1.0 affecting this, but it should be possible to power down the unused RAM in v3.0.0 as well.

    - Okay, I will check. 

     However, since you are able to power down unused parts of RAM, you will not have full 256 RAM retention, which will reduce current compared to the above. Additionally, you can use LFXO as a clock source instead of LFRC, and use an external crystal, which will have slightly lower current consumption than using LFRC.

    - No, I have note configured yet. But would like to configure. But LFRC give me better result then how to configure this? Is there any example for reference? 

    Thanks and Regards

    Rohit R

  • Hi Marte, 

    Any update on above post?

    My understanding is correct to configure SED device?If yes, then will configure likewise and test for current. Let me know your feedback.

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    Rohit Rajapure said:
    If I configure as SED. It will give comparatively less current than getting now correct?

     Yes, that is correct.

    Rohit Rajapure said:
    And, If I just call sleep now () in zigbee_signal_handler means it is configured as SED

    This is not entirely correct.

    To configure the device as a SED you must call zb_set_rx_on_when_idle(ZB_FALSE) in main, such as in the multi sensor example. This enables sleepy behavior and makes your device act as a Sleepy End Device.

    You are correct in that you must call zb_sleep_now() in zboss_signal_handler(), when receiving the signal ZB_COMMON_SIGNAL_CAN_SLEEP. Again, you should do as in the multi sensor example.

    Rohit Rajapure said:
    And I can comment this part from code to make SED? Correct? 

     Yes, with SED you will use zb_sleep_now() to put the device and radio to sleep, and you can remove zb_osif_go_idle() from main.c. The function zb_osif_go_idle() is not really necessary to have in main.c if you are not using SED either, as it is already implemented in external/zboss/osif/zb_nrf52840_common.c. The only reason to use it in main.c is if you want to override the function to make it do something else than what it does in the implementation in zb_nrf52840_common.c.

    Rohit Rajapure said:
    But LFRC give me better result then how to configure this? Is there any example for reference? 

     You can read about the clock sources for the LFCLK controller here: LFCLK controller. Further down on that page you will find 32.768 kHz crystal oscillator (LFXO), where you can read about LFXO.

     You can see more about typical current consumption for nRF52840 in the electrical specification, where you can find information such as sleep current and radio transmitting/receiving current. The nRF52840 specification does not show the typical current for using LFXO, only LFRC, but the electrical specification for some of the other SoCs does, to show a comparison between using LFRC and LFXO as clock source:

    ION_RAMON_RTC System ON, Full 24 kB RAM retention, Wake on RTC (running from LFRC clock) 1.5 µA 
    ION_RAMON_RTC_LFXO System ON, Full 24 kB RAM retention, Wake on RTC (running from LFXO clock) 1.1 µA

    Please note that the above numbers are from another SoC than the nRF52840 and has different typical current consumption than nRF52840.

    Best regards,

    Marte

Related