Learn MoreFAQsTutorials

9个帖子/ 0新
Last post
insi
Offline
Last seen:3 years 4 months ago
加入:2017-07-20 15:50
No connection received.

Hi,,
I having problem connecting two devices.

Dev1 (slave) is sending advertisement containing data which I want to retrieve on Dev2 (Central).

Dev1似乎罚款并在没有任何问题的情况下进行规划,并且在DEV2上达到了DEV2在CALL APP_EASY_GAP_START_CONNECTION_TO_SET上达到其广告。我想连接到设备,并且我理解我调用app_easy_gap_start_connection_to_set。最终在取消扫描App_easy_gap_start_connection_to之后。

Scanning on Dev2 is done as:

void user_scan_start(void)
{
printf_string("Scanning...\r\n");
struct gapm_start_scan_cmd* cmd = KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd);
cmd->op.code = GAPM_SCAN_PASSIVE;
cmd-> op.addr_src = gapm_public_addr;
cmd->interval = 10;
cmd->window = 5;
cmd->mode = GAP_OBSERVER_MODE;
cmd->filt_policy = SCAN_ALLOW_ADV_ALL;
cmd->filter_duplic = SCAN_FILT_DUPLIC_DIS;

// Send the message
ke_msg_send(cmd);

// We are now connectable
ke_state_set(TASK_APP, APP_CONNECTABLE);
}

Upon callback from user_on_adv_report_ind, the params are:
param->report.adv_addr_type: 0x01 and correct mac address of the device I'm expecting.

However, I don't seem to get any connection and after some debugging I get to gapm_cmp_evt_handler with parameters: operation=0x12 and status=0x40. Status clearly indicated that invalid parameters is passed. I presume at app_easy_gap_start_connection_to_set. However not why.

I can't wrap my head around it. Any help is appreciated. Thanks.

Device:
insi
Offline
Last seen:3 years 4 months ago
加入:2017-07-20 15:50
Update,

Update,

更改MTU(至23)和min,最大连接间隔为100 ms让我缩放到Gap_err_Protocol_Problem。为什么这是非常有帮助的指南。

MT_dialog
Offline
Last seen:6 days 20 hours ago
工作人员
加入:2015-06-08 11:34
Hi insi,

Hi insi,

据我所知,从你所获得的事实和错误,0x12是由于参数无效取消连接,所以你传递给app_easy_gap_start_connection_to_set()的参数是什么?没有文件,以便设备充当一个中央,但您可以在主机侧看看DSP参考设计。您描述的程序是正确的,我没有看到改变连接的间隔之间的关系,但是,设备的间隙角色是什么,是它的gap_observer_sca吗?我问这个是因为我看到设备在Gap_observer_mode(在扫描函数中)扫描,而Gap_err_protocol_Probram是我可以用上面的角色配置复制的东西,这是因为如果您不能有连接设备在Obserever模式下运行。

Thanks MT_dialog

insi
Offline
Last seen:3 years 4 months ago
加入:2017-07-20 15:50
感谢您的答复!

感谢您的答复!

我将模式更改为GAP_GEN_DISCOVERY,但现在我GET GAP_ERR_INVALID_PARAM。

我正在遵循DSP参考(如其他论坛帖子所示)。

The role is: GAP_CENTRAL_MST.

I trying to a device using app_easy_gap_start_connection_to_set:

if (memcmp(param->report.adv_addr.addr, mac_addr, 6) == 0)
{
printf_string("Connecting.\r\n");

app_easy_gap_start_connection_to_set(param->report.adv_addr_type,
(uint8_t *)¶m->report.adv_addr.addr,
MS_TO_DOUBLESLOTS(USER_CON_INTV));
user_gapm_cancel();
}


static void user_gapm_cancel(void)
{
/* Disable Advertising */
struct gapm_cancel_cmd * cmd = app_gapm_cancel_msg_create();
app_gapm_cancel_msg_send(cmd);
}


void user_on_scanning_completed(void)
{
printf_string("Scanning completed\r\n");

app_easy_gap_start_connection_to();
}

I thought this the way as referenced in DSPS design reference. What am I missing?

JK_Dialog
Offline
Last seen:1 week 5 days ago
工作人员
加入:2016-08-22 23:07
嗨insi,in order to connect

嗨insi,in order to connect the central must be able to see the advertisement, then send a connection request. So when connecting, this starts a temporary scan. If you look into your app_easy_gap_start_connection_to_set( .. ), the gap_start_connection_cmd requires your scan_interval, window, etc. So right after this call, you send user_gapm_cancel(), which will stop this operation, hence the cancellation callback.

Let me know if removing this resolves this issue.

Thanks JK_dialog

insi
Offline
Last seen:3 years 4 months ago
加入:2017-07-20 15:50
Hi JK_Dialog,

Hi JK_Dialog,
Thanks for your answer but still no go I'm afraid. I changed the mode toGAP_GEN_DISCOVERABLE,

I have the DSPS version 5.150.2. In that example it uses theuser_gapm_cancel()刚过app_easy_gap_start_connection_to_set(..). Do I have the wrong version or it's about time settings regarding the intervals?

I removed theuser_gapm_cancel()和之后的10年代(gapm_start_scan_cmd.intverval = 10) and flow is this:
- During this 10s interval, the callbackuser_on_adv_report_ind(...)在现在只有一旦我注册'设备连接使用app_easy_gap_start_connection_to_set(...).
- After 10s, the callbackuser_on_scanning_completed()被正确调用。

The flow and status I am getting is:
gapm_cmp_evt_handler.:
1.0 msgid: w0
1.1 operation: 11
1.2 status: 45

Scanning completed

gapm_cmp_evt_handler..
2.0 msgid: w0
2.1 operation: 12
2.2 status: 41

So I'm getting Timeout before Protocol problem. When usingapp_easy_gap_start_connection_to_set(..)., I gave been changingUSER_CON_INTV参数从12.5(DSP主机示例)到10000(推测10秒):

void user_on_adv_report_ind(struct gapm_adv_report_ind const * param)
{
if (memcmp(param->report.adv_addr.addr, mac_addr, 6) == 0)
{
if(connected == false)
{
printf_string(“连接到设备\ r \ n”);

app_easy_gap_start_connection_to_set(param->report.adv_addr_type,
(uint8_t *)¶m->report.adv_addr.addr,
MS_TO_DOUBLESLOTS(USER_CON_INTV));
connected = true;
}
}
}
Any ideas?

JK_Dialog
Offline
Last seen:1 week 5 days ago
工作人员
加入:2016-08-22 23:07
嗨insi,

嗨insi,

I apologize - I wasn't as familiar with the DSPS host. I see now they are waiting for scanning to be finished piror to sending the connect command. BTW, a connection interval of 10 seconds is outside the BLE specification.

您能从user_config.h文件中向我发送以下配置 - user_scan_conf(如果适用)和user_central_conf?

Thanks JK

insi
Offline
Last seen:3 years 4 months ago
加入:2017-07-20 15:50
Hi,

Hi,

Interval > 10 s according to BLE spec. Yes, you're right but at this point I've been experimenting everything. I used MS_TO_DOUBLESLOTS(10000) which is dividing by 1.25 so I presume I' was safe.

I only have user_config.h. I have also attached other configs just in case. However, these are taken straight off from ble_app_barebone example. But please doulbe check if something is odd.

In DSPS example astruct central_configuration已被定义,但我无法在当前(稍后)的SDK中找到这一点。所以我认为它已被推翻。如果我错了,请纠正我。

Thanks again!

Attachment:
JK_Dialog
Offline
Last seen:1 week 5 days ago
工作人员
加入:2016-08-22 23:07
嗨insi,can we try using the

嗨INSI,我们可以尝试使用DSPS Comment examper并使用外围地址修改此文件吗?让我们看看是否可以以这种方式连接连接。