Problem using notifications

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
5 posts / 0 new
最后一篇
MAX44
离线
Last seen:9个月1周前
加入:2016-02-08 15:58
Problem using notifications

Hello Dialog,

I've recently run into a problem using notifications that I'm hoping you might help with.

有一段时间我一直在运行自定义应用程序,基于BLE_APP_Peripheral示例在外部存储器中记录传感器数据。我在Android应用程序中实现了一个命令,该应用程序检索录制的数据并将其存储在Android平板电脑上的文件中。为此(基于此论坛的建议),我使用了20个字节特性,具有读取,写入和通知属性。该过程是从Android应用程序启用通知,然后向DA发送自定义命令以开始数据传输。这只是通过通知消息发送20个字节,然后等待通知通过Custs1_Val_ntf_cfm确认通知,然后使用另一个通知消息发送20个字节。然后重复该过程,直到发送所有预期数据。这有效,我已经使用这种技术发送了大块数据。

最近,我尝试在改变时向某些传感器数据添加通知。此特征已经已定义了通知属性,但我没有使用过它。这也似乎可以正常工作。当启用通知时,检测到它们时会发送传感器数据更改,我可以在Android平板电脑上显示它。每秒一次以一次慢速发生。但是,在测试时,我找到了如果我禁用传感器数据通知,然后尝试如上所述的数据传输,它将开始,传输几千字节并停止。当发生这种情况时,DA需要重置。到目前为止,我一直无法确定为什么发生这种情况。它对我没有意义为什么可以启用/禁用另一个特征的通知会导致我的数据传输特性发生故障。在我与DA14580的经验中,这似乎与未被消耗和累积的消息相似,直到系统发生故障。 I don't know how to verify if that's what is happening or not though ..... or if the problem is something else.

Any ideas what might cause this and/or what I might look at? So far I've carefully looked over the database description in user_custs1_def.c and the handlers in user_custs1_impl.c and haven't seen anything incorrect so far. I had used the ADC example in ble_app_peripheral as a guide as to what was required.

谢谢,最大

设备:
MT_dialog
离线
Last seen:2 months 6 days ago
职员
加入:2015-06-08 11:34
嗨max44,

嗨max44,

从您描述的行为来看,我会假设你正在生成消息,而不是消耗它们(显然设备命中不能够分配内存的断言),也许当前连接的连接间隔不是频繁足以让您发送的数据实际上不是累计的。我不确定我完全了解你表演的测试。检查您获得的断言,并确保您触及未能分配内存断言,因为您确保您的设备停止响应的原因,如果您不小心以某种方式在不实际发送的情况下生成数据。

Thanks MT_dialog

MAX44
离线
Last seen:9个月1周前
加入:2016-02-08 15:58
MT,

MT,

Sorry. I was trying to be brief and not burden you with too much information. I'll put together a more detailed description of my testing that hopefully will give you a clearer picture what I'm attempting to do and the malfunction I'm getting.

I don't think I'm getting an assert error as you mentioned above, but I'll revisit that. I tried looking at where I stopped in the Keil debugger but it wasn't clear. I do get the data transfer to run without error from a power on state. That is, I read and transfer 17,000 bytes (** see below) from SPI flash to my Android tablet and stored the data in a file on the tablet. Upon examination, the data in the tablet file looks correct. This seems to indicate that the connection interval is adequate, but I left it at the ble_app_peripheral example settings, which I think are 10 min and 20 max. I had thought that the custs1 code would adjust to what the connection interval is as by the following comment from custs1_task.c:
The GATTC_CMP_EVT message that signals the completion of a GATTC_NOTIFY
*operation is sent back as soon as the notification PDU has been sent over
*the air.
So this sends the CUSTS1_VAL_NTF_CFM that I get in user_peripheral.c and I use that to indicate I can send the next notify. Doesn't this imply the BLE packet has been transmitted? And in my case, since I'm sending 20 bytes, it should go out in a single BLE transmission.

困扰我的是数据传输自身的运作,可以向Android平板电脑发送大量数据。如果我去并激活另一个特征的通知,它会导致数据传输例程失败。我难以弄清楚互动是什么.....或者如果我在某处的代码中完成了愚蠢和/或有错误。到目前为止,我在代码中没有发现错误,但我会继续看。

谢谢,最大

(** 17,000字节)。17,000可能看起来像一个奇怪的数字,但我真的在寻找16,384个字节。由于20个字节特征(如您所知由BLE数据有效载荷确定),我的数据传输算法从Flash读取1000个字节,并将其推出到Android平板电脑,其中50 x 20字节通知。我决定了最简单的事情,将要运行17个循环的迭代,让平板电脑或PC数据通过数据筛选并丢弃额外的速度。BLE模块和Android平板电脑设置为固定的17,000字节发送和接收环路。

MAX44
离线
Last seen:9个月1周前
加入:2016-02-08 15:58
MT,

MT,

我终于发现是错误的。原来一个ndroid app was not sending a descriptor to disable notifications even though a button on the GUI was touched to do so. The app I'm using is generated by Bluetooth Developer Studio + Android Studio and behaves similar to Blue Loupe. My sensor data characteristic had GUI buttons for read, write, and enable notifications to interact with the DA14580 custom service I implemented. Touching the enable notifications button sends a descriptor with the enable value and changes the button to disable notifications. The Android app was just re-sending the enable value when you touch the button to disable notifications. Since I was updating sensor data once per second, I was expecting that disabling notifications would switch back to updating the characteristic database for a read. Instead I was continuing to send notifications when they were disabled on the tablet, resulting in an error.

我发现禁用通知是其他Android开发人员与Android BLE服务的遇到问题,如果此论坛上的其他人遇到此问题,有一些修复程序在线建议。

I made the correction and it looks like I'm receiving the descriptor value to disable notifications on the DA14580 now. And the data transfer now appears to be working after enabling and disabling notifications on my sensor data characteristic.

So we can now close this topic. Thanks for listening!

Regards, Max

MT_dialog
离线
Last seen:2 months 6 days ago
职员
加入:2015-06-08 11:34
嗨max44,

嗨max44,

Thanks for sharing.

Best Regards MT_dialog