跳到主要内容

Directed advertise

2个月前

Directed advertise

张贴了adam.stroz.20分 9回复
0旋转

你好,

我正在尝试在DA14531芯片上运行直接广告,但我无法看到它工作,以下是我添加的代码(基于extent_periphertial_template):

static const struct default_app_operations user_default_app_operations = {.default_operation_adv = user_advertise_operation,};void user_advertise_operation(void){app_easy_gap_dircated_advertise_start(0); // 0和1具有相同的结果}

我试图通过将这部分代码添加到app_direct_advertise_complete乐趣来重新启动广告。

... user_app_callbacks的一部分.app_on_adv_direct_complete = app_direct_advertise_complete,... void app_direct_advertise_complete(const uint8_t x){app_easy_gap_directed_advertise_start(0);}

I check adv packet with BLE sniffer application, and i also tryed to discover my device by using central implementation app with andother DA14531.
如果我在app_direct_advertise_complete中插入断点,则x可禁止的x值为0x45(表示超时错误)。
我有两个问题:
如果我必须在手机上看到包(在BLE嗅探器应用程序中),如果我在user_adv_conf结构中输入的.PEER_ADDR中输入了错误的中央地址?

如何检查广​​告是否正常工作(我只有开发套件 - USB板)?

2个月前

PM_DIALOG.

嗨adam.stroz,

谢谢你的问题。在回答您的问题之前,我首先要突出显示直接广告用于建立非常快速的连接。根据Bluetooth LE规范,如果您知道中央BD地址,您可以宣传指示。

请注意,如果您使用的是移动电话作为中央设备,则手机通常使用随机BD地址,这意味着BD地址将不断变化,因此,您将无法知道。可以仅在中央使用公共BD地址的情况下完成定向广告,并且每次都没有改变。

中央的BD地址应在user_config.h头文件中的user_adv_config结构的.peer_addr_type中添加。然后,App_easy_gap_dircated_advertise_start()API应在User_App_Adv_Start()中使用适当的BD地址到上述字段。在直接广告中,PDU仅包括设备的BD地址。

请参阅下面的一个快速示例,展示具有高占空比的定向广告。请在SDK6.0.14的BLE_APP_PHERIZEAL示例中使用此操作。

SDK位置:6.0.14.1114 \ Projects \ target_apps \ ble_examples \ ble_app_peripheral \ keil_5

1.使用以下user_app_adv_start()。从user_peripher.c文件中删除app_addata_update_timer_used,并注释出app_add_ad_struct()。

void user_app_adv_start(void){struct gapm_start_advertise_cmd * cmd;cmd = app_easy_gap_dircated_advertise_get_active(0);app_easy_gap_dircated_advertise_start(0);}

2,如果您运行它,将会发生NMI。为避免NMI,您有两种选择:

A] Put the device into sleep mode when the directed adverting is timed out. To do so, you should add arch_set_extended_sleep(false) after app_easy_gap_directed_advertise_start(0). If it is still acting in active mode, it will wait for an interrupt, the WDOG will time out and an NMI will occur.

B] Use the . app_on_adv_direct_complete = user_app_adv_direct_complete in order to restart adverting. ( same as undirected advertising)

void user_app_adv_direct_complete(uint8_t status){if(status == gap_err_timeout){user_app_adv_start();}}

3.当指向广告超时时,状态将是GAP_ERR_TIMEOUT(= 0x45)。

当然,您应该在user_adv_config struct中添加合适的BD地址

有2种模式可用于指示广告:高占空比和低占空比

i]高占空比:广告将持续〜1.28秒(ADV间隔为1.25ms)。如果没有中央连接到外围设备,则会发生超时。

II}低占空比:外围设备将永远使用user_config.h中定义的adv区间通告。

在这两种情况下,BLE嗅探器可用于捕获ADV_DIRECT_IND广告数据包。

谢谢,PM_DIALOG.

2个月前

adam.stroz. 20分

你好,

我测试了你写信给我的东西:

在DA14531模块上,我启动BLE Central应用程序,下面的Config(我只使用公共BD Addres仅用于测试目的):

#define scan_filter(scan_filter_none)#define connect_to_peripheral(0)#define cfg_nvds_tag_bd_address {0x01,0x00,0x70,0xca,0xea,0x80} #define user_cfg_address_mode app_cfg_addr_pub

在DA14531(USB DEV套件)上我开始BLE_APP_PERITERAL(使用您写信给我的设置):

#define CFG_NVDS_TAG_BD_ADDRESS {0x03, 0x00, 0x70, 0xCA, 0xEA, 0x80} #define USER_CFG_ADDRESS_MODE APP_CFG_ADDR_PUB void user_app_adv_start(void) { struct gapm_start_advertise_cmd* cmd; cmd = app_easy_gap_directed_advertise_get_active(0); app_easy_gap_directed_advertise_start(0); } void user_app_adv_direct_complete(uint8_t status) { if (status == GAP_ERR_TIMEOUT) { user_app_adv_start(); } }

但不幸的是我什么也看不见inall (i see only other devices), in BLE sniffer I also don't see any packets from DA14531 (USB dev kit) .

1个月前

PM_DIALOG.

嗨adam.stroz,

请您提供嗅探器日志吗?此外,您能否请使用SS工具箱中的电源分布器来检查设备是否是广告?

谢谢,PM_DIALOG.

1个月前

adam.stroz. 20分

嗨,不幸的是我没有Prodk板,但我使用示波器检查电流消耗(我测量与电源串联连接的电阻上的电压)。我在程序中打开了各种选项(指示_Advertise和Untived_Advertise)并检查了电力消耗图表以查看广告。

在来自示波器的附件屏幕截图中。首先,我经营无向广告(default_advertise_operation),以查看da14531是否工作和发送adv。数据包(UNFOWETED_ADVERTES.JPG)然后我开始了以下代码:

void user_app_adv_start(void){struct gapm_start_advertise_cmd * cmd;cmd = app_easy_gap_dircated_advertise_get_active(0);app_easy_gap_dircated_advertise_start(0);void app_direct_advertise_complete(const uint8_t x){if(x == gap_err_timeout){user_advertise_operation();}}

照片s指示_Advertise_start(0)_wf.jpgand指示_Advertise_Start(0)_wf_2.jpg。当您看到设备发送adv时。所有时间的数据包,但我在嗅探器应用程序上没有看到任何东西。

接下来我试穿了定向广告如果没有此功能(照片_Advertise_Start(0)_wwf.jpg)

void app_direct_advertise_complete(const uint8_t x){/ * if(x == gap_err_timeout){user_advertise_operation();} * /}

And finally i try to change arguments inapp_easy_gap_dircated_advertise_start.功能从0到1(照片指示_advertise_start(1).jpg)

所以我做了一些测试,它表明设备正在发送,但我仍然无法在BLE应用程序(BLE Sniffer和B-BLE)上看到它。照片嗅探器,jpg.shows only packets from my TV and watch.

附件 尺寸
指示_Advertise_start(0)_wf.jpg 52.22 KB.
指示_Advertise_Start(0)_wf_2.jpg 60.01 KB.
directed_advertise_start(0)_wwf.jpg 46.62 KB.
指示_Advertise_Start(1).jpg 48.44 kB.
UNITOWETED_ADVERTERS.JPG. 56.16 KB
sniffer.jpg. 165.94 KB.

1个月前

PM_DIALOG.

嗨adam.stroz,

谢谢你的评论。在我以前的回复中,我的意思是使用BLE嗅探器工具(如果有)而不是移动BLE应用程序。我检查了指示_advertise_start(1).jpg,似乎设备启动广告无向。可能是您使用的应用程序无法检测到广告数据包。如果您有BLE嗅探器工具可用,则应能够通过空中捕获Adv_Direct_ind广告数据包。如果另一个DA14531用作间隙中央,则在间隙外设方面,确实在user_config.h标题文件中添加了user_adddr_type结构的中央的BD地址in.peer_addr_type项目?

谢谢,PM_DIALOG.

1个月前

adam.stroz. 20分

你好,
抱歉被误导,我没有BLE嗅探器设备(工具),我只使用智能手机和/或第二DA14531(带间隙Central -Da14585-DA14586-DA14531_Central_Implementation示例)。我检查了中央和外围设备的设置,一切似乎都可以。

中央设置的#define USER_CFG_ADDRESS_MODE APP_CFG_ADDR_PUB和#define USER_CFG_CNTL_PRIV_MODE APP_CFG_CNTL_PRIV_MODE_NETWORK的#define CFG_NVDS_TAG_BD_ADDRESS {0×01,0×02,0x70,0xCA,0xEA,0x80的}的#define SCAN_FILTER(SCAN_FILTER_NONE)的#define CONNECT_TO_PERIPHERAL(0)PERIPHERIAL设置///端设备的地址///注意:意味着指向广告(ADV_DIRECT_IND).PEER_ADDR = {0x01,0x02,0x70,0xca,0xea,0x80} ///地址类型(0 = public / 1 = wondon)///注意:意味着对于定向广告(ADV_DIRECT_IND).PEER_ADDR_TYPE = 0,void user_advertise_operation(void){struct gapm_start_advertise_cmd * cmd;cmd = app_easy_gap_dircated_advertise_get_active(0);app_easy_gap_dircated_advertise_start(0);void app_direct_advertise_complete(const uint8_t x){if(x == gap_err_timeout){user_advertise_operation();}}

I get the following results in the terminal (i see only TV and sometimes my watch):

-------------- END_ADV ----------缺口类型:00,数据:1C RSSI:-55 BD_ADDR:58:80:3C:47:8B:84 -------------  -  end_Adv ----------  -  GAP标志:1C RSSI:-71 BD_ADDR:58:80:3C:47:8B:84-------------- END_ADV ----------缺口类型:00,数据:1C RSSI:-60 BD_ADDR:58:80:3C:47:8B:84 -------------  -  END_ADV ----------

我还可以做些什么 ?我应该用什么应用来查看这些包?

1个月前

adam.stroz. 20分

所以我终于看到了我的设备。我在下面的代码中运行了中央示例并打开了广播:

void user_advertise_operation(void){ struct gapm_start_advertise_cmd* cmd; cmd = app_easy_gap_directed_advertise_get_active(0); app_easy_gap_directed_advertise_start(0); } void app_direct_advertise_complete(const uint8_t x){ if (x == GAP_ERR_TIMEOUT) { user_advertise_operation(); } }

在中央方面,我必须更改以下参数:

#define scan_intvl_ms(20)#define scan_window_ms(20)

在Terminall中,我看到其他DA14531的数据包:

差距类型:00,数据:rssi:rssi:-34 bd_addr:80:ea:ca:70:00:01 ------------- END_ADV ----------

但我有两个问题:

首先,为什么我只看到一个数据包?(我的设备全部发送数据包)

如何正确设置Scan_Intvl_ms和scan_window_ms paramterers?

1个月前

adam.stroz. 20分

你好,

我的问题怎么样?我注意到,如果我的设备仍在发送(定向通告),如果我重置中央设备,我将始终注意一个消息。

GAP Type: 00, Data: <-RESET RSSI: -38 BD_ADDR:80:ea:ca:70:00:01 ---------------END_ADV----------- <0><0>AGAP Type: 00, Data: <-RESET RSSI: -39 BD_ADDR:80:ea:ca:70:00:01 ---------------END_ADV----------- <0><0>AGAP Type: 00, Data: <-RESET RSSI: -42 BD_ADDR:80:ea:ca:70:00:01 ---------------END_ADV----------- <0><0>AGAP Type: 00, Data: <-RESET RSSI: -39 BD_ADDR:80:ea:ca:70:00:01 ---------------END_ADV-----------

1个月前

PM_DIALOG.

亚当,

Apologies for the delay. According to the Bluetooth LE specification you can advertise and be scanned by a specific device if you are aware of the BD address of the scanner and if the peripheral is using directed advertising. On the central side, the device will start scanning for devices, so it seems that you can see your Peripheral that is advertising directed. The results you are seeing come from the user_on_adv_report_ind() callback function.

每个发现的设备都将显示一次。您可以使用另一个外设来检查它。

另请参阅第3.2节中的步骤#1。每个设备都显示一次。

http://lpccs-docs.dialog-seminiondiond.com/sw_example/sdk6/central -implingation/description.html.

>>我应该如何正确设置Scan_Intvl_ms和scan_window_ms paramterers?

你能澄清这句话吗?中央SW示例使用扫描间隔和50ms的窗口。

谢谢,PM_DIALOG.