1 month ago
Directed advertise
张贴了adam.stroz20分 9回复Hello,
I'm trying to run direct advertising on the Da14531 chip but I can't see it working, below is the code which I added (based on empty_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_directed_advertise_start(0);//0 and 1 have the same result }
我试图通过将这部分代码添加到app_direct_advertise_complete乐趣来重新启动广告。
... Part of 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.
If i insert a breakpoint in app_direct_advertise_complete the x varriable has a value of 0x45 (which indicates a timeout error).
我有两个问题:
如果我必须在手机上看到包(在BLE嗅探器应用程序中),如果我在user_adv_conf结构中输入的.PEER_ADDR中输入了错误的中央地址?
How to check if advertise is working ( I only have a Development Kit-USB board)?
1 month ago
Hello,
我测试了你写信给我的东西:
On DA14531 MODULE i start BLE central app, below config (i use PUBLIC BD Addres only for test purposes):
#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 month ago
Hi adam.stroz,
请您提供嗅探器日志吗?此外,您能否请使用SS工具箱中的电源分布器来检查设备是否是广告?
Thanks, PM_Dialog
1 month ago
Hi, unfortunately I do not have a ProDK board, but I use an oscilloscope to check the current consumption (I measure the voltage on the resistor connected in series with the power supply). I turned on various options in the program (directed_advertise and undirected_advertise) and checked the power consumption chart to see advertising.
In the attachment screenshots from oscilloscope. First i run undirected advertise (default_advertise_operation) to see if DA14531 working and sending adv. packets (undirected_advertise.jpg) then I started this code:
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();}}
照片sdirected_advertise_start(0)_wf.jpganddirected_advertise_start(0)_wf_2.jpg.当您看到设备发送adv时。所有时间的数据包,但我在嗅探器应用程序上没有看到任何东西。
Next i tryed run定向广告如果没有此功能(照片_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)上看到它。照片sniffer,jpgshows only packets from my TV and watch.
附件 | Size |
---|---|
directed_advertise_start(0)_wf.jpg | 52.22 KB |
directed_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 month ago
Hi adam.stroz,
谢谢你的评论。在我以前的回复中,我的意思是使用BLE嗅探器工具(如果有)而不是移动BLE应用程序。我检查了指示_advertise_start(1).jpg,似乎设备启动广告无向。可能是您使用的应用程序无法检测到广告数据包。如果您有BLE嗅探器工具可用,则应能够通过空中捕获Adv_Direct_ind广告数据包。如果另一个DA14531用作间隙中央,则在间隙外设方面,确实在user_config.h标题文件中添加了user_adddr_type结构的中央的BD地址in.peer_addr_type项目?
Thanks, PM_Dialog
1 month ago
Hello,
抱歉被误导,我没有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, Data: 1c RSSI: -55 BD_ADDR:58:80:3c:47:8b:84 ---------------END_ADV----------- GAP FLAGS: 1c RSSI: -71 BD_ADDR:58:80:3c:47:8b:84 ---------------END_ADV----------- GAP Type: 00, Data: 1c RSSI: -60 BD_ADDR:58:80:3c:47:8b:84 ---------------END_ADV-----------
What else can I do ? What application should I use to view these packages?
1 month ago
所以我终于看到了我的设备。我在下面的代码中运行了中央示例并打开了广播:
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)
and in terminall i see packet from other DA14531:
差距类型:00,数据:rssi:rssi:-34 bd_addr:80:ea:ca:70:00:01 ------------- END_ADV ----------
But i have two questions:
First, why i see only one packet? (My device sending packet all time)
如何正确设置Scan_Intvl_ms和scan_window_ms paramterers?
1 month ago
Hello,
how about my questions? I noticed that if my device is still transmitting (directed advertising), if i resets the central device, I will always notice one message.
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 month ago
亚当,
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.
Every discovered device will be displayed once. You can use another Peripheral to check it.
See also step #1 in Section 3.2. Each device is displayed once.
http://lpccs-docs.dialog-seminiondiond.com/sw_example/sdk6/central -implingation/description.html.
>>我应该如何正确设置Scan_Intvl_ms和scan_window_ms paramterers?
Can you please clarify this statement? The Central SW Example is using scan interval and window at 50ms.
Thanks, PM_Dialog
1 month ago
Hi adam.stroz,
谢谢你的问题。在回答您的问题之前,我首先要突出显示直接广告用于建立非常快速的连接。根据Bluetooth LE规范,如果您知道中央BD地址,您可以宣传指示。
Please note that if you are using a mobile phone as a Central device, the mobile phones are usually using random BD addresses, which means that the BD address will be changing continually and so, you won’t be able to know it. Directed advertisement can be done only in the case that the Central is using a public BD address and is not changing every time.
The Central’s BD address should be added in the .peer_addr_type of the user_adv_config structure in the user_config.h header file. Then, the app_easy_gap_directed_advertise_start() API should be used in user_app_adv_start() with a proper BD address to field mentioned above. In the direct advertisement, the PDU includes only the BD address of the device.
See below a quick example demonstrating the directed advertisement with a high duty cycle. Please follow this in ble_app_peripheral example of the SDK6.0.14.
SDK location : 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()。
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)
3. When the directed advertising times out, the status will be GAP_ERR_TIMEOUT (= 0x45).
当然,您应该在user_adv_config struct中添加合适的BD地址
There are 2 modes available for directed advertising: High duty cycle and low duty cycle
I] High duty cycle: The advertising will last for ~1.28sec (adv interval is 1.25ms). If no central connects to the peripheral, a timeout will occur.
II} Low duty cycle: The peripheral will advertise forever using the adv interval defined in user_config.h.
In both cases, the BLE sniffer can be used to capture the ADV_DIRECT_IND advertising packets.
Thanks, PM_Dialog