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

The NRF52840 seems to not receive response from Green Power endpoints.

Hi,

I am currently using a NRF52840 dongle with the python wrapper for the zigbee library.

When I send a Discover Attribute to a Green Power cluster in a Green Power Endpoint, it seems that the dongle does not receive any response from the device. I know the device send a response because I can see the frame with WireShark but the Wrapper seems to ignore it and sens a Request Timeout.

The command I use is the following : 

zcl cmd -w -d {ieee_addr} 242 21 -p A1E0 C -l 0000ff

Thanks for your help.

Parents Reply Children
  • Using Wireshark, the sniffer manage to capture the command frame : 

    Then the selected device send to the dongle this response : 

    The frame is here but it seems the dongle doesn't see it. To be a bit precise, I did not touch the GP feature of the dongle's firmware.

  • Hi,

    You may need to intercept this command response if you want to do more processing to the discover attribute response. From what I see on the ZCL specification there is not much to expect from the stack handling when the Discover attribute response is received:

    Take a look at the documentation on "Executing interception mechanism" on the infocenter for more information on how to intercept ZCL packets.

    Best regards,

    Marjeris

  • Hi,

    The thing is that I can intercept any kind of data frame just fine but I can't intercept anything when I send any command with the Green Power Profile.

  • Can you share with us the code you are using for intercepting these frames?

  • /**@brief The Handler to 'intercept' every frame coming to the endpoint
     *
     * @param bufid    Reference to a ZBOSS buffer
     */
    static zb_uint8_t cli_agent_ep_handler_generic_cmd(zb_bufid_t bufid)
    {
        zb_zcl_parsed_hdr_t * p_cmd_info = ZB_BUF_GET_PARAM(bufid, zb_zcl_parsed_hdr_t);
        zb_int8_t             row;
        zb_ret_t              zb_err_code;
    
        /* Get the row in the requests table according by the sequence number */
        row = get_cmd_table_row_by_sn(p_cmd_info->seq_number);
        if (row == -1)
        {
            return ZB_FALSE;
        }
    
        cmd_query_t * p_row = &(m_cmd_data[row]);
        if (!is_response(p_cmd_info, p_row))
        {
            return ZB_FALSE;
        }
        if (p_cmd_info->cmd_id == ZB_ZCL_CMD_DEFAULT_RESP)
        {
            zb_zcl_default_resp_payload_t * p_def_resp;
            p_def_resp = ZB_ZCL_READ_DEFAULT_RESP(bufid);
    
            /* Print info received from default response */
            nrf_cli_fprintf(p_row->p_cli,
                           (p_def_resp->status == ZB_ZCL_STATUS_SUCCESS) ? NRF_CLI_INFO : NRF_CLI_ERROR,
                           "\r\nDefault Response received: ");
            nrf_cli_fprintf(p_row->p_cli,
                           (p_def_resp->status == ZB_ZCL_STATUS_SUCCESS) ? NRF_CLI_INFO : NRF_CLI_ERROR,
                           "Command: %d, Status: %d",
                            p_def_resp->command_id, p_def_resp->status);
            nrf_cli_fprintf(p_row->p_cli,
                           (p_def_resp->status == ZB_ZCL_STATUS_SUCCESS) ? NRF_CLI_INFO : NRF_CLI_ERROR,
                           "\r\n");
    
            if (p_def_resp->status != ZB_ZCL_STATUS_SUCCESS)
            {
                print_error(p_row->p_cli, "Command not successful", ZB_TRUE);
            }
            else
            {
                print_done(p_row->p_cli, ZB_FALSE);
            }
        }
        else if (p_cmd_info->cmd_id == ZB_ZCL_CMD_DISC_ATTRIB_RESP)
        {
            zb_zcl_disc_attr_info_t * p_attr_resp = NULL;
            zb_uint8_t complete = 0;
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "\r\nList Attribute Response received: \r\n");
            ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES(bufid,complete);
            nrf_cli_fprintf(p_row->p_cli,
                            NRF_CLI_INFO,
                            "complete:%d\r\n",
                            complete);
            
            ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES(bufid,p_attr_resp);
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "list attr,type: \r\n[");
            while (p_attr_resp)
            {
                nrf_cli_fprintf(p_row->p_cli,
                            NRF_CLI_INFO,
                           "(%d,%d),",
                            p_attr_resp->attr_id, p_attr_resp->data_type);
              
                ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES(bufid,p_attr_resp);
            }       
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "]\r\n");
            print_done(p_row->p_cli, ZB_FALSE);
        }
        else if (p_cmd_info->cmd_id == (ZB_ZCL_CMD_DISCOVER_COMMANDS_RECEIVED_RES) || 
            (p_cmd_info->cmd_id ==ZB_ZCL_CMD_DISCOVER_COMMANDS_GENERATED_RES))
        {
            zb_zcl_disc_cmd_info_t * p_cmd_resp = NULL;
            zb_uint8_t complete = 0;
            zb_zcl_parse_status_t status;
    
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "\r\nList Command Response received: \r\n");
            ZB_ZCL_GENERAL_GET_DISC_COMMAND_RESP(bufid,complete);
            nrf_cli_fprintf(p_row->p_cli,
                            NRF_CLI_INFO,
                            "complete:%d\r\n",
                            complete);
            
            ZB_ZCL_GENERAL_GET_NEXT_CMD_ID_DISC_COMMAND_RESP(bufid,p_cmd_resp);
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "list cmd: \r\n[");
            while (p_cmd_resp)
            {
                nrf_cli_fprintf(p_row->p_cli,
                            NRF_CLI_INFO,
                           "%d,",
                            p_cmd_resp->cmd_id);
              
                ZB_ZCL_GENERAL_GET_NEXT_CMD_ID_DISC_COMMAND_RESP(bufid,p_cmd_resp);
            }       
            nrf_cli_fprintf(p_row->p_cli,
                           NRF_CLI_INFO,
                           "]\r\n");
            print_done(p_row->p_cli, ZB_FALSE);
        }
        else /* In case of unknown response */
        {
            print_error(p_row->p_cli, "Unknown response", ZB_TRUE);
        }
        /* Cancel the ongoing alarm which was to erase the row... */
        if (m_cmd_data[row].def_resp == ZB_ZCL_ENABLE_DEFAULT_RESPONSE)
        {
            zb_err_code = (ZB_SCHEDULE_APP_ALARM_CANCEL(invalidate_row_cb, row));
            ZB_ERROR_CHECK(zb_err_code);
        }
        /* ...and erase it manually */
        invalidate_row(row);
    
        zb_buf_free(bufid);
        return ZB_TRUE;
    }
    
    
    /**@brief Endpoint handlers
     */
     NRF_ZIGBEE_EP_HANDLER_REGISTER(generic_cmd, cli_agent_ep_handler_generic_cmd);
    /** @} */
    Every function works with profile Home Automation, but it doesn't when I try to work with endpoint 242 and Green Power Profile
Related