View: 2306|Reply: 3

How to use bdb_join_direct() function ?

[Copy link]

33

Threads

27

Replies

487

Credits

Credits
487
Posted on 2025-8-12 11:01:24 | Show all posts |Reading mode From 韩国
information
Notes:   建议参照本版块置顶帖内容输入必要信息
Chip model: tlsr8258
SDK & version: zigbee_ble_concurrent_sdk_v2.4.0.1
How to use bdb_join_direct() function ?

33

Threads

27

Replies

487

Credits

Credits
487
 Author| Posted on 2025-8-14 10:07:59 | Show all posts From 韩国

Buyer's Coordinator Information
- channel : 19
- pan id : 0x4B1C
- ext pan id : 0x35A980B2CD34C3AE
- security key : 0x3E4F3F1BEC449651904EAA1FF5BAF119

I run below function, but the sampleLight is not connected to the coordinator.
How to connect the sampleLight to the coordinator ?

s32 sampleLight_bdbNetworkJoinDirect2(void)
{
        u8 extPanId[] = {0xae, 0xc3, 0x34, 0xcd, 0xb2, 0x80, 0xa9, 0x35 };
        u8 nwkKey[] = {0x19, 0xf1, 0xba, 0xf5, 0x1f, 0xaa, 0x4e, 0x90, 0x51, 0x96, 0x44, 0xec, 0x1b, 0x3f, 0x4f, 0x3e };
//        u8 nwkKey[] = {0x3e, 0x4f, 0x3f, 0x1b, 0xec, 0x44, 0x96, 0x51, 0x90, 0x4e, 0xaa, 0x1f, 0xf5, 0xba, 0xf1, 0x19};
        u8 tcAddr[] = {0x78, 0x56, 0x34, 0x12, 0x24, 0x10, 0x15, 0x20 };

        g_joinNetworkInfo.channel = 19;
        g_joinNetworkInfo.panId = 0x4B1C;
        g_joinNetworkInfo.nwkAddr = 0x5555;

#if 0 // SEMODE Distributed
        if(SUCCESS == bdb_join_direct(g_joinNetworkInfo.channel, g_joinNetworkInfo.panId, g_joinNetworkInfo.nwkAddr, extPanId, nwkKey, SS_SEMODE_DISTRIBUTED, 1, NULL))
#else // SEMODE Centralized
        if(SUCCESS == bdb_join_direct(g_joinNetworkInfo.channel, g_joinNetworkInfo.panId, g_joinNetworkInfo.nwkAddr, extPanId, nwkKey, SS_SEMODE_CENTRALIZED, 1, tcAddr))
#endif
        {
                return -1;
        }
        return 0;
}

22

Threads

113

Replies

587

Credits

Credits
587
Posted on 2025-8-14 12:57:17 | Show all posts From 澳大利亚
本帖最后由 wes58 于 2025-8-14 13:05 编辑
jylee@kme21.com 发表于 2025-8-14 10:07
Buyer's Coordinator Information
- channel : 19
- pan id : 0x4B1C

I haven't done it but have a look in the ZibBee BLE concurrent sampleSwitch project.
You will find this function:
  1. int zb_ble_hci_cmd_handler(u16 cmdId, u8 len, u8 *payload){
  2.         int ret = 0;
  3.         if(cmdId == APP_BLE_CMD_ZB_NETWORK_JOIN){
  4.                 bdb_networkSteerStart();
  5.         }else if(cmdId == APP_BLE_CMD_ZB_FACTORY_RESET){
  6.                 zb_resetDevice2FN();
  7.         }else if(cmdId == APP_BLE_CMD_ZB_NETWORK_JOIN_DIRECT){
  8.                 g_joinNetworkInfo.channel = payload[0];
  9.                 g_joinNetworkInfo.panId = ((u16)payload[1] | ((u16)payload[2] << 8));
  10.                 g_joinNetworkInfo.nwkAddr = ((u16)payload[3] | ((u16)payload[4] << 8));

  11.                 if(g_switchAppCtx.timerSteering){
  12.                         TL_ZB_TIMER_CANCEL(&g_switchAppCtx.timerSteering);
  13.                 }

  14.                 TL_ZB_TIMER_SCHEDULE(sampleSwitch_bdbNetworkJoinDirect, NULL, 50);
  15.         }else{
  16.                 ret = -1;
  17.         }
  18.         return ret;
  19. }
Copy code


You will see how this function sampleSwitch_bdbNetworkJoinDirect or in your example sampleLight is a function that is called. There are other paramaters that have to be set before it is called.
  1. TL_ZB_TIMER_SCHEDULE(sampleSwitch_bdbNetworkJoinDirect, NULL, 50);
Copy code

30

Threads

374

Replies

1196

Credits

Credits
1196
Posted on 2026-8-10 15:38:57 | Show all posts From 江苏

Credit rules for this forum

Follow our WeChat
Privacy Policy|Telink Developer Community

For copyright infringement reports, complaints or suggestions, please email forum@telink-semi.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|沪ICP备17008231号-1 |沪公网安备31011502403548号

inThis forumPostBack to top