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.

[参考译文] LP-EM-CC2340R53:无法在车门锁日志中查看车门锁的信标。

Guru**** 2343490 points
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1528922/lp-em-cc2340r53-the-beacon-of-the-door-lock-cannot-be-viewed-in-the-door-lock-log

器件型号:LP-EM-CC2340R53
Thread 中讨论的其他器件:UNIFLASHSYSCONFIG

工具/软件:

您好、Ryan

根据 定制门锁的标准实例、全部执行了步骤 1 至 3。 但是、我没有看到步骤 4 的效果。 我想查看请求日志、其中包括锁的信标。 请帮助我检查哪个步骤出错。  

使用的协调器是 onoff_light 的一个实例。

车门锁的实例代码如下:  

/****** Application variables declarations ******/
zb_uint16_t g_dst_addr;
zb_uint8_t g_addr_mode;
zb_uint8_t g_endpoint;
zb_bool_t perform_factory_reset = ZB_FALSE;

zb_bool_t cmd_in_progress = ZB_FALSE;

/****** Application function declarations ******/
/* Handler for specific ZCL commands */
zb_uint8_t zcl_specific_cluster_cmd_handler(zb_uint8_t param);
void test_device_interface_cb(zb_uint8_t param);
void send_toggle_req(zb_uint8_t param);
void button_press_handler(zb_uint8_t param);
void send_lock_req(zb_uint8_t param, zb_uint8_t lock_or_unlock);

/****** Cluster declarations ******/

// THIS CODE REPLACES IT
  /* Door Lock cluster attributes data */
zb_uint8_t g_attr_door_lock_lock_state = 0;
zb_uint8_t g_attr_door_lock_lock_type = 0;
zb_bool_t g_attr_door_lock_actuator_enabled = ZB_FALSE;
ZB_ZCL_DECLARE_DOOR_LOCK_ATTRIB_LIST(door_lock_attr_list, &g_attr_door_lock_lock_state,
                                      &g_attr_door_lock_lock_type, &g_attr_door_lock_actuator_enabled);

/* Basic cluster attributes */
zb_uint8_t g_attr_zcl_version  = ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE;
zb_uint8_t g_attr_power_source = ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE;

ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(basic_attr_list, &g_attr_zcl_version, &g_attr_power_source);

/* Identify cluster attributes */
zb_uint16_t g_attr_identify_time = ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;

ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &g_attr_identify_time);

/* Groups cluster attributes */
zb_uint8_t g_attr_name_support = 0;

ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(groups_attr_list, &g_attr_name_support);

#ifdef ZB_ZCL_SUPPORT_CLUSTER_SCENES
/* Scenes cluster attributes */
zb_uint8_t g_attr_scenes_scene_count = ZB_ZCL_SCENES_SCENE_COUNT_DEFAULT_VALUE;
zb_uint8_t g_attr_scenes_current_scene = ZB_ZCL_SCENES_CURRENT_SCENE_DEFAULT_VALUE;
zb_uint16_t g_attr_scenes_current_group = ZB_ZCL_SCENES_CURRENT_GROUP_DEFAULT_VALUE;
zb_uint8_t g_attr_scenes_scene_valid = ZB_ZCL_SCENES_SCENE_VALID_DEFAULT_VALUE;
zb_uint16_t g_attr_scenes_name_support = ZB_ZCL_SCENES_NAME_SUPPORT_DEFAULT_VALUE;

ZB_ZCL_DECLARE_SCENES_ATTRIB_LIST(scenes_attr_list, &g_attr_scenes_scene_count,
    &g_attr_scenes_current_scene, &g_attr_scenes_current_group,
    &g_attr_scenes_scene_valid, &g_attr_scenes_name_support);
#else
zb_zcl_attr_t scenes_attr_list[] = { ZB_ZCL_NULL_ID, 0, 0, NULL };
#endif

/* Declare cluster list for the device */

ZB_HA_DECLARE_DOOR_LOCK_CLUSTER_LIST(door_lock_clusters, 
                                door_lock_attr_list, 
                                basic_attr_list, identify_attr_list, 
                                groups_attr_list, scenes_attr_list);
ZB_HA_DECLARE_DOOR_LOCK_EP(door_lock_ep, ZB_OUTPUT_ENDPOINT, door_lock_clusters);
ZB_HA_DECLARE_DOOR_LOCK_CTX(device_ctx, door_lock_ep);


static zb_bool_t error_ind_handler(zb_uint8_t severity,
                                   zb_ret_t error_code,
                                   void *additional_info);
                                   

/* test_device_interface_cb */

case ZB_ZCL_DOOR_LOCK_LOCK_DOOR_CB_ID:
    {
      zb_uint8_t lock_state = ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_LOCKED;
      uart2_printf("Lock the door");
      ZVUNUSED(zb_zcl_set_attr_val(ZB_OUTPUT_ENDPOINT,
                                  ZB_ZCL_CLUSTER_ID_DOOR_LOCK,
                                  ZB_ZCL_CLUSTER_SERVER_ROLE,
                                  ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID,
                                  &lock_state,
                                  ZB_FALSE));
      zb_osif_led_on(0);
    }
    break;
    case ZB_ZCL_DOOR_LOCK_UNLOCK_DOOR_CB_ID:
    {
      zb_uint8_t lock_state = ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_UNLOCKED;
      uart2_printf("Unlock the door");
      ZVUNUSED(zb_zcl_set_attr_val(ZB_OUTPUT_ENDPOINT,
                                  ZB_ZCL_CLUSTER_ID_DOOR_LOCK,
                                  ZB_ZCL_CLUSTER_SERVER_ROLE,
                                  ZB_ZCL_ATTR_DOOR_LOCK_LOCK_STATE_ID,
                                  &lock_state,
                                  ZB_FALSE));
      zb_osif_led_off(0);
    }
    break;
    
/* in button_press_handler add */

void button_press_handler(zb_uint8_t param)
{
  ZVUNUSED(param);
  uart2_printf("button is pressed, do nothing\r\n");
  if (!param)
  {
    /* Button is pressed, gets buffer for outgoing command */
    zb_buf_get_out_delayed(button_press_handler);
  }
  else
  {
    user_print("button_press_handler %d\r\n", param);
    // send_toggle_req(param);
    send_lock_req(param, ZB_ZCL_CMD_DOOR_LOCK_LOCK_ID);
#ifndef ZB_USE_BUTTONS
    /* Do not have buttons in simulator - just start periodic on/off sending */
    ZB_SCHEDULE_APP_ALARM(button_press_handler, 0, 7 * ZB_TIME_ONE_SECOND);
#endif
  }
}
    
/*send lock message*/
void send_lock_req(zb_uint8_t param, zb_uint8_t lock_or_unlock)
{
  zb_uint16_t addr = 0;

  ZB_ASSERT(param);

  if (ZB_JOINED() ) // && !cmd_in_progress
  {
    cmd_in_progress = ZB_TRUE;

    user_print("send_lock_req %d - sending %s command\r\n", param,
                "LOCK" );

    /* Send Door Lock command via binding (destination unknown) */ // ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_REQ
    ZB_ZCL_DOOR_LOCK_SEND_LOCK_DOOR_REQ(
      param,
      addr,
      ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT,
      0,                       // no addr/endpoint needed because using binding
      ZB_SWITCH_ENDPOINT,      // source endpoint
      ZB_FALSE,                // no default response
      NULL);         // command: 0x00 = LOCK, 0x01 = UNLOCK
  }
  else
  {
    user_print("send_lock_req %d - not joined or busy\r\n", param);
    zb_buf_free(param);
  }
}
以下是请求的日志。
此致、  
Yongjian
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Yongjian:

    首先、请确保您不使用 其他 E2E 帖子中共享的 UART2 代码、因为必须单独解决此实现的问题。

    在重新编程新固件之前、擦除 Uniflash 或 CCS 中的所有芯片存储器可能会有所帮助。

    接下来、确认您正在监听 SysConfig 文件中配置的相同通道。  每次在 CCS 调试器中运行固件或以其他方式复位器件时(假设尚未加入 Zigbee 网络)、您应该会看到信标请求。  您的 Zigbee 网络 ZC/ZC 设备需要先启用允许加入、然后设备才能加入。

    在将项目迁移到新应用程序之前、应使用默认的 ON_OFF 灯和切换工程进行测试、以确认您充分掌握加入流程(最终应用程序不应影响这一点)。

    此致、
    Ryan