我已经搜索了这些论坛,尽可能多的信息,我可以收集,我已经看了整个网站吞吐量评估和spssource code and I am somewhat familiar with them and understand them to a degree. They do remain somewhat opaque for me... perhaps you all can humor me here.
I don't need super high throughput... >3k bytes/second. I have an interrupt that happens every 2ms that generates 6 bytes. But I have been unable to achieve this using the standard GATT notification mechanism (If I generate an interrupt every 4ms, I start losing data). So my first question is, does this seem wrong to anyone? I keep a queue of 20 byte packets to send via GATT notification. I check the queue after the GATTC_CMP_EVT message and schedule to send the next packet if one is available. The system can't keep up and it fails after about 100 packets (more if I make the queue bigger, much less if I clock at a 2ms interrupt period).
所以,假设上述方法行不通,我看了吞吐量评估项目。它似乎使用了多个特征(数据似乎是并行写入所有这些特征)和l2cap。我很难看到接收数据的客户在这里做什么,因为这里没有示例。客户端是否也必须与l2cap交互?不幸的是,我的Windows电脑除了GATT之外什么都不做,所以我不知道如何协调这个问题。
SPS does something which I didn't think you could do. The characteristic (SPS_SERVER_TX) has a size of 128 characters. I didn't think you could notify an object that large (when I tried it, it didn't work). Perhaps I am missing some key aspect here but I also can't tell what the maximum throughput here should be.
画廊的任何建议都会有帮助。
谢谢,
马可
你好,马可德,
系统中是否启用了睡眠?你应该能够以这种速率发送数据,如果睡眠被启用,当中断被禁用时,你可能会丢失数据,你也会处理这些数据吗?你说系统出故障了,是不是交给了硬故障处理程序?另外,您如何发送通知?在中断处理程序中填充队列并更新数据库中的值?
不,客户端不必与l2cap交互。
DSPS项目发送一个mtu交换命令(这允许主机,如果他接受它,可以接收更大的mtu),您可以尝试它,如果您喜欢,但我认为这是您的问题。
谢谢你的对话
谢谢你的回复。不支持睡眠模式d. There is no processing of the data. The interrupt fills the queue and if the queue was empty when it puts one in, it sends an initial message to the streaming task to send the next item in the queue.. The streaming task processes this message (by putting the data in the database and sending the notification) in the normal course of things. When the GATTC_NOTIFY message comes, it checks to see if there are more packets to send and if so, sends itself a message to send the next item in the queue. And so it goes for infinity. It takes 3 interrupts to fill up a packet (18 bytes + 2 bytes of status). At an interrupt period of 8ms (125Hz, 24ms/packet) everything works great. In fact, the queue never gets more than 1 item put in it. With an interrupt period of 4ms (12ms/packet) the queue fills up. I get about 100 valid packets received at the client. I fully acknowledge that I may have screwed this machinery up somehow but if I did I don't know where... it's not that complicated.
(Note: packets are removed from the queue on the GATTC_NOTIFY to prevent multiple messages/packets in circulation. I had that problem at first causing the queue to go below empty... thankfully no humans or pets were harmed in the ensuing catastrophe.)
连接间隔是默认值(我认为是7.5或8ms IIRC)。
谢谢,
马可
你好,马可德,
你能试着从ISR设置一个标志吗?然后检查app\u asynch\u trm中的标志,如果设置了这个标志,就把消息发送给流任务。从ISR发送到流任务的消息可能会导致您面临的问题。你可以上传一个智能狙击手图像,而你是连接和发送数据(当它失败时,当它没有)?
谢谢你的对话
从ISR设置标志并将消息作为主循环的一部分发送似乎没有帮助。我连接了一个示波器,翻转了一个GPIO位。当我将中断速率设置得足够低(<180赫兹,每16.7毫秒一次数据包)时,从发送数据包到收到GATTC\ U通知(如果有的话,我可以发送下一条消息)之间的时间大约是800us,偶尔会有高达1.2毫秒的闪光。在那里非常稳定。当频率超过195Hz时,范围内的事情就变得混乱了,但我能够测量到,在许多情况下,数据包被发送到GATTC\u NOTIFY之间的时间大于55ms。当这些长时间间隔足够长时,队列就会被填满。我将致力于获取智能代码片段图像(我还没有使用该软件)。
(编辑:SmartSnippets似乎有问题,因为它找不到ftd2xx.dll文件. 我有Windows 10…)
Hi marcodg
An image from smart snippets would help, are you triggering the sending of the next packet by waiting the previous GATTC_NOTIFY completetion event ?
你能试着不用等待就发送信息吗?
谢谢你的对话
谢谢你的回复。我will need some coaching on "smart snippets". I got SmartSnippets to start up (downloaded the drivers) and can download the code and get it running. But after that, I'm not really sure what to do. I see a "Data Rate Monitor" on the lower right, but pushing the buttons don't seem to have an effect. I should note that I am using a PAN1740 module.
在其他新闻中,我尝试将MTU的大小从23增加到87,认为如果我可以发送更少的数据包,它就会工作。虽然它确实允许我增加频率(高达240Hz左右),但它仍然以同样的方式失败。包被发送到GATTC\ u NOTIFY之间的时间非常长,在这种情况下大约是60ms,这比要求的包频率要长。
If I do not wait for the GATTC_NOTIFY and send a packet when it is ready, say, every 52.8ms corresponding to the 87 byte MTU (I require a packet every 32ms), packets get dropped at the source. I have a sequence number in the packet I send. The values are non-contiguous. Usually only one packet is dropped but I have seen as many as two.
I am continuing to examine the code to make sure I'm not messing up.
还是没什么好运气。我试着使用l2cc(比如吞吐量评估项目),但是在更高的吞吐量下,在GATT失败的地方,设备会重新启动。在较高的中断率下,GATTC\u NOTIFY消息发送的时间过长,导致队列被填满。如果我不等待消息包被丢弃,即使它们仅仅以每50ms(87字节MTU)一个包的速度出现。我尝试过改变MTU的大小,但这似乎没有帮助,除了更大的数据包稍微好一点。
我修改了代码,这样ISR本身就不会发生真正的处理。kermel消息作为app\u asynch\u trm()函数的一部分发送。
The fact that GATTC_NOTIFY takes so long is a mystery because at lower interrupt rates, that send/wait process is only a couple of ms.
Hi marcdg,
你能给我们发一些智能片段活动,也许我们可以看看,找到一些东西。
谢谢你的对话
我无法让智能代码片段工作。该设备是松下1740。我已经定义了数据流和度量。我可以将代码下载到设备(jlink),但是datarate监视器只支持com端口。“启动外设”按钮通常不起作用,其余时间显示错误。
我想我找到问题了。使用wireshark,我能够从客户端(一台运行windows10的PC)跟踪对话。我可以看到PC机在每个L2CAP片段后都用空的PMU包进行响应。有时,响应时间太长,迫使数据备份到我的设备上。我不是一个BLE专家,所以你能确认客户端的响应(以空PMU的形式)需要在下一个传输包之前发生吗?
谢谢
马可
你好,马可德,
We couldn't tell much from the log you uploaded (in your other post, i assume that you are examining the same case), as some packets seem to be missing. In general, the host polls the device in every connection Interval with either empty PMUs or data packets (if something needs to be sent). With these packets the host has the ability to acknowledge that the previous packet the device sent was received and also perform some kind of flow control. If the packet is not acknowledged then it has to be resent. In other words, if the host explicitly doesn't acknowledge a packet then the device cannot send another one until this packet is eventually acknowledged from the host. This way the host can block the device from sending more packets. In any case though, the host always polls the device! Thus, what you reported, that the host stalls in sending the empty POLL packets, is a problem, if it indeed happens and is not produced by the sniffer which does not seem very reliable.
谢谢你的对话