关于BLE扫描的一些问题

12个帖子/ 0新
最后一篇
2455321262
离线
最后看到:2年7个月前
加入:2017-01-22 06:43
关于BLE扫描的一些问题

I set the device role as central,I use the following function
static void user_scan_start(void)
{
struct gapm_start_scan_cmd * cmd = ke_msg_alloc(gapm_start_scan_cmd,
task_gapm,task_app,
gapm_start_scan_cmd);

cmd->op.code = user_scan_conf.code;
cmd->op.addr_src = user_scan_conf.addr_src;
cmd->interval = user_scan_conf.interval;
cmd->window = user_scan_conf.window;
cmd->mode = user_scan_conf.mode;
cmd-> filt_policy = user_scan_conf.filt_policy;
cmd->filter_duplic = user_scan_conf.filter_duplic;

// Send the message
ke_msg_send(cmd);

//我们现在是可连接的
ke_state_set(task_app,app_connectable);
}
要使设备启动扫描。但是,它不能执行到App_On_Scanning_Completed的函数。(我指的是DSP的项目)
我错过了什么吗?而且我没有找到BLE_Central的项目?你能告诉我哪里可以下载在哪里?
我希望你告诉我如何配置BLE开始扫描?我认为内核任务或遗漏存在一些错误。
Thanks in advance

Device:
MT_dialog
离线
最后看到:2 months 3 weeks ago
职员
加入:2015-06-08 11:34
Hi 2455321262,

Hi 2455321262,

app_on_scanning_completed回调是当设备停止该扫描过程时要执行的函数,通过扫描操作超时(近似8秒)或取消操作。因此,如果您不开始扫描,回调将永远不会执行,因此您不会获取函数来执行。设备配置完成后(设备配置完成后,将发生.app_on_set_dev_config_complete回调)这是您应该放置开始扫描操作的位置。另外,对于一个中央的示例,您可能希望查看主机项目中的DSP参考设计。您将能够在支持门户上的参考设计部分下找到DSP参考设计。

Thanks MT_dialog

2455321262
离线
最后看到:2年7个月前
加入:2017-01-22 06:43
Hi MT_dialog,

Hi MT_dialog,
感谢您的建议,我是Suer I调用函数在函数中启动扫描.App_on_set_dev_config_complete回调。但我的设备无法实现函数.app_on_set_dev_config_complete .i发现我的设备能够扫描到周围的蓝牙信号,我没有知道设备为什么没有扫描超时,超时时间固定8秒钟?如果不是8秒,我可以在哪里配置它?
I hope you can help me as soon as possible,Thanks in advance.

Chris0409.
离线
最后看到:3 years 10 months ago
加入:2017-01-11 05:59
Hi, 2455321262

Hi, 2455321262
You can start a timer to cancel the scan process, and thus your program can hit the scan-complete callback.
You can cancel the current scan like this.
struct gapm_cancel_cmd *cmd =(struct gapm_cancel_cmd *) KE_MSG_ALLOC(GAPM_CANCEL_CMD, TASK_GAPM, TASK_APP, gapm_cancel_cmd);
cmd->operation = GAPM_SCAN_PASSIVE; // Set GAPM_SCAN_PASSIVE
ke_msg_send(cmd);// Send the message

2455321262
离线
最后看到:2年7个月前
加入:2017-01-22 06:43
你好,chrise0409

你好,chrise0409
I think it's a good idea to solve my problem ,thanks for your advicing.But I still want to know how to configure automatic scan timeout?I think that would do no harm to me.

MT_dialog
离线
最后看到:2 months 3 weeks ago
职员
加入:2015-06-08 11:34
Hi Jerry,

Hi Jerry,

扫描程序扫描约8秒默认情况下,没有选项才能更改,扫描功能在GAP_GEN_DISCOVERY或GAP_LIM_DISCOVERY中扫描时,如果您不希望此时才能扫描GAP_OBSERVER_MODE(您将能够在RW-BLE-GAP-IS中找到更多信息。我没有得到的是确切的问题,你的设备扫描在开始时扫描,你没有看到在超时发生时执行的扫描功能?如果您的设备扫描意味着设备执行扫描过程的某个地方(我想在App_On_set_dev_config中发生)。DSP在user_on_set_dev_config_complete(.app_on_set_dev_config_complete回调)中启动扫描,并且当发生超时时(超时不会取消).App_on_scanning_Completed会被触发。检查在custom_on_scanning_Completed()上使用的回调函数()您要检查扫描的状态是否仅扫描_err_canceled而不是超时(gap_err_timeout)。如果在您使用的项目中调用回调app_on_scanning_completed(),请在app_task.c中检查appm_cmp_evt_handler()。要在您使用的项目中调用,以便实现您的项目。

case GAPM_SCAN_ACTIVE:
case GAPM_SCAN_PASSIVE:
{
执行_CALLBACK_PARAM(app_on_scanning_completed, param->status);
}
break;

Thanks MT_dialog

2455321262
离线
最后看到:2年7个月前
加入:2017-01-22 06:43
你好,MT_dialog,

你好,MT_dialog,

非常感谢您的建议,我告诉过您在哪里逐个检查,现在我的扫描已经能够成功运行,真的非常感谢你

Thanks Jerry

MT_dialog
离线
最后看到:2 months 3 weeks ago
职员
加入:2015-06-08 11:34
Hi Jerry,

Hi Jerry,

我不确定我理解这个问题,当你不处理app_on_scanning_completed时(你在你的回调中提供null)完全会发生什么?如果您不处理扫描的完成,您的设备将在不做任何事情的情况下进入睡眠状态。我没有看到Jlink与您不处理扫描完成的事实有关。

Thanks MT_dialog

2455321262
离线
最后看到:2年7个月前
加入:2017-01-22 06:43
你好,MT_dialog,

你好,MT_dialog,
对我对我的问题的错误声明感到抱歉。
我发现在睡眠模式下唤醒后,我的J-Link在唤醒后没有正常工作。
我处于调试模式,前辈的某人说DA14580不能在睡眠模式和调试模式下,我想我已经进入了睡眠模式成功,但在实现函数ARCH_RESUME_FROM_SLEEP之后,我的J-Link将无法正常工作,似乎辞掉了调试模式?

我找到了如下的功能:

void ble_slp_handler(void)
{
syscntl_use_highest_amba_clocks();

toggle_gpio13_short.

power_up(); // power-up the BLE core

wakeup_lp_comp = 0;//下次清除标志

SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 0);

SetBits16(GP_CONTROL_REG, BLE_WAKEUP_REQ, 0);

...................
}
can i comment out the code of SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 0)? or modify as SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 1)?
If I want to enter both debug and sleep mode at the same time , What shuould I do ?

Thanks Jerry

MT_dialog
离线
最后看到:2 months 3 weeks ago
职员
加入:2015-06-08 11:34
Hi Jerry,

Hi Jerry,

In older SDK's you couldn't be in sleep mode and debug at the same time, that feature is added with the SDK5.0.4, so up until 5.0.3 you couldn't debug with keil and be in sleep mode. If the SDK that you are using is the 5.0.3 and you have removed the piece of code that halted the fw in the check_sys_start_up_period() that prevented the device of going to sleep while the debugger was enabled then you can remove the disabling the debugger in the SLP handler (remove the SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 0); ) and you should be able to do what you would like. The reason for what you are experience is exactly the fact that the debugger module of the ARM is disabled while your are in debug mode.

Thanks MT_dialog

Wisilica.
离线
最后看到:10 months 3 weeks ago
加入:2015-03-17 08:16
你好,

你好,

我想问一下与这个线程有关的东西。
当扫描以一般可被发现/有限的可发现模式执行时,即使是连续接收广告报告的情况,超时会发生超时吗?或者,只有在扫描模式期间没有收到BLE数据包?

Thanks
Wisilica.

MT_dialog
离线
最后看到:2 months 3 weeks ago
职员
加入:2015-06-08 11:34
Hi wisilica,

Hi wisilica,

If the scanning you are performing is either GAP_GEN_DISCOVERY or GAP_LIM_DISCOVERY the operation will timeout automatically regardless the advertising reports, so even if the device doesn't receive any reports the scan procedure will timeout after about 8 seconds.

Thanks MT_dialog