设备在AVG中每20秒断开连接

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
12个帖子/ 0新
最后一篇
Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
设备在AVG中每20秒断开连接

你好,
I'm using DA14580 to transfer data via UART.
When I added the uart connection, the devices gets disconnected from the phone every 20sec in avg.
If I don't use uart, the device does not disconnect. (from the main loop I send uart request every 10sec)
user_app_disconnect.20SEC通过电话连接到设备后调用。

我的UART实现可能导致设备断开连接是什么?或者,如何防止设备断开连接。
如何弄清楚导致断开连接的原因。

Thanks,
Ezza

Device:
Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
调试后,GAPC

调试后,GAPC_disconnect_ind_handler is invoked.

static int gapc_disconnect_ind_handler(ke_msg_id_t const msgid,
struct gapc_disconnect_ind const * param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
if(ke_idx_get(src_id)== diss_env.con_info.conidx)
{
diss_disable(param->conhdl);
}

return(ke_msg_consumed);
}

-----------------------------------
gapc_disconnect_ind const * param参数有一个断开连接的原因。

///表示链接已断开连接
struct gapc_disconnect_ind.
{
///连接句柄
uint16_t conhdl;
///断开的原因
uint8_t理由;
};
原因值为0x08。

mt_dialog.
离线
最后一次露面:3 months 2 days ago
职员
加入:2015-06-08 11:34
嗨Ezza,

嗨Ezza,

Well, what i can assume is that you are keeping the ARM occupied using the UART and there are no BLE events scheduled during that time, so the device never gets up on time for the connection event, eventually you are loosing the connection event and the timeout occurs. The disconnection reason that you get is due to connection timeout which indicates that you are missing connection events.

谢谢mt_dialog.

Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
你好,

你好,
Thanks for the reply.
How can I prevent that from happening?
I don't want my device to get disconnected during uart event.

Ibbkoeln.
离线
最后一次露面:4个月2天前
加入:2016-03-18 10:34
嗨Ezza,

嗨Ezza,

也许您在主循环中的UART调用期间正在进行一些耗时或阻塞操作?你是什​​么意思“主循环”?据我所知,用户应用程序API中没有主循环,只是回调。我想我们必须看到你的代码更好地了解这一点。

Regards,
Oliver

Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
你好,

你好,
Since DA14580 does not have a "Read" indication event. I had to enter the Main arch and added a custom code there.
在Arch_Main的主循环中,我调用UART命令来更新BLE的DB,以便手机应用读取更新的数据。
例如,我在我的ST固件上有一个计数器,该计数器正在全部更新,并且应用程序需要读取该计数器。我通过每10秒发送来自主循环的UART命令,在BLE的DB上保持更新。

有什么方法可以增加价值的时间吗out for the disconenction event? (i.e. even if I don't catch connection events, wait longer than 20s).
为什么通过UART发送\获取命令会导致断开连接?

Thanks,
Ezza

Ibbkoeln.
离线
最后一次露面:4个月2天前
加入:2016-03-18 10:34
嗨Ezza,

嗨Ezza,

要定期阅读值,我强烈建议使用易于计时器API而不是更改ARCH_MAIN,因为这可以很容易地打扰BLE定时。以下是我如何实现这一点:

#define read_value_interval 1000 // 1 => 10ms

静态timer_hnd readvaluetimer = easy_timer_invalid_timer;
静态UINT8 rxdata [rx_size];

void rxuartcallback(uint8状态){
if(state == uart_ok){
// process rxData here
ReadValuetimer = app_easy_timer(100,ReadValueFromuart);
} 别的 {
// error handling
}
}

void readValueFromUart() {
uart_read(rxData, RX_SIZE, rxUartCallback);

uint8 cmd [] = {...};
UART_WRITE(cmd,sizeof(cmd),null);
}

void user_on_connection(uint8_t connection_idx,struct gapc_connection_req_ind const * param){
......
readValueTimer = app_easy_timer(READ_VALUE_INTERVAL, readValueFromUart);
}

void user_on_disconnect(struct gapc_disconnect_ind const * param){
if(readvaluetimer!= easy_timer_invalid_timer){
app_easy_timer_cancel(ReadValuetimer);
readvaluetimer = easy_timer_invalid_timer;
}
}

Regards,
Oliver

Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
你好,

你好,
不幸的是,它仍然是相同的问题。我更改了代码并从Arch_Main中删除了所有内容并使用Easy_Timer。
此外,即使我从手机上发送活动,如“写入”,它仍然将在AVG中的20SEC中断开连接。

Ibbkoeln.
离线
最后一次露面:4个月2天前
加入:2016-03-18 10:34
Is the connection stable

Is the connection stable without reading/writing to a characteristic and only reading values over uart continuously in background?

Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
你好,

你好,
It's not stable even when I'm doing nothing (no read and no write).
I just connect to the device and waited for it to get disconnected.

Ezza
离线
最后一次露面:1 year 6 months ago
加入:2017-09-07 11:33
你好,

你好,
Where can I jandle the disconnection event, and prevent it from happening?
Its a blocker for us, since the device keeps getting disconnected and the phone-application get's exceptions till it finally success reading all the values from ble. This causes a dramatic decrease of the performance.

mt_dialog.
离线
最后一次露面:3 months 2 days ago
职员
加入:2015-06-08 11:34
嗨Ezza,

嗨Ezza,

您将阻止任何UART活动重叠连接间隔,UART通信应突发,而不是长时间占用的ARM,因为您可以按时按时编程BLE事件。例如,您可以在.app_on_system_powered中附加一个UART逻辑才能处理任何UART事件,但您不应该长时间留在那里,您应该返回Keep_Power后,以便再次强制计划_While_ble_on()以重新运行以便安排任何将发生的BLE事件,然后SDK将在其余的UART活动中再次运行.app_on_system_powered。关于增加监督超时,我想现在超时大约20秒如果增加它,那么这将从断开连接取决于您正在使用的连接间隔,但再次这不是您应该查看您的实现的解决方案为了在UART交互期间不放松连接事件。您无法停止断开触发断开,只要监控超时发生,即使阻止您的回调仍将断开该消息,也会从堆栈中从堆栈中获取。

谢谢mt_dialog.