<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19878/ble_gattc_evt_timeout-possible-causes</link><description>Hello, 
 I am still having troubles with the BLE_GATTC_EVT_TIMEOUT. The problem is that the error is not happening frequently and is hard to reproduce. It is also hard to attach a sniffer to each connection (and the nRF sniffer doesn&amp;#39;t even work reliably</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Feb 2017 13:40:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19878/ble_gattc_evt_timeout-possible-causes" /><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77361?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 13:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7839391-9ddf-4fc5-871f-ed190357f244</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;I don&amp;#39; use authorization. I will open a support case for this in a few minutes. It is really hard to simplify the code but I could point you to the classes that make are involved in this incident.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77360?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 13:22:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a94eb403-15b9-4335-babc-1c46a1fd34d5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Marius,&lt;/p&gt;
&lt;p&gt;The issue you described here might not be the same as what you observed in the original question. In the trace you provided in the question the softdevice actually stopped sending packet when in your newer trace the softdevice still sent empty packet until the connection terminated.&lt;/p&gt;
&lt;p&gt;They may not be the same problem.&lt;/p&gt;
&lt;p&gt;Regarding the new trace. I do agree that GATTC_EVT_TIMEOUT is unexpected and could be an issue with softdevice. I suspect it could be confused when there are multiple connections and are doing lots of reliable write.&lt;/p&gt;
&lt;p&gt;Do you use authorization for handle 0x000e or not ? If you use authorization, we can think of an issue on the application code that delayed the reply for the write request.&lt;/p&gt;
&lt;p&gt;About those packets that you&amp;#39;re suspecting:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;61 &amp;lt;===&amp;gt; 53&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Packet 15363: We don&amp;#39;t see a response for the write request earlier could be because it was sent in the previous connection event but the sniffer couldn&amp;#39;t capture it. You can see the delta time of 20ms instead of 10ms between 15365 and 15364. Implying that there must be a packet in between. The SN and NESN also confirm this. More likely just the sniffer couldn&amp;#39;t capture it.&lt;/p&gt;
&lt;p&gt;But I do see the connection termination came 30 seconds after these packets, there must be something wrong there.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;54 &amp;lt;==&amp;gt; 507&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another glitch with the sniffer I suspect, the &amp;quot;Connection oriented channel&amp;quot; packet actually just a corrupted Write response. You can see the CRC mismatch and the content of this packet is almost identical with the normal write response. SN and NESN doesn&amp;#39;t show that there was retransmission or anything.&lt;/p&gt;
&lt;p&gt;But then again the connection terminated 30 seconds after this, it&amp;#39;s hard to explain.&lt;/p&gt;
&lt;p&gt;We may need to have your code to test here, I can setup 8 beacons. I would prefer to have a simplified version of your code that can show the issue, so it&amp;#39;s easier to dig up the code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77358?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 11:57:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:842d7bd2-659d-4d1f-8dc5-1f5babf70755</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;I added an answer instead of a comment, i hope that&amp;#39;s ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77359?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 10:48:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6bb4b6b-e6b2-42a0-8b12-147a526502e8</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;Alright, I have to add an &amp;quot;answer&amp;quot; to describe the problem because the comments are too restricted.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I did a test with 8 devices that form a scatternet and they are all working normally. The error happens on all of these dongles. I used S130 v2.0.1&lt;/li&gt;
&lt;li&gt;I logged all output from these 8 nodes on UART&lt;/li&gt;
&lt;li&gt;I used 4 Sniffers to log connections&lt;/li&gt;
&lt;li&gt;I managed to catch a few connections where the failure appeared.&lt;/li&gt;
&lt;li&gt;I did not test with only two devices because I think it will take a very long time and maybe the failure will never appear.&lt;/li&gt;
&lt;li&gt;Please forget about the sniffer trace discussed above because it might be another issue.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;61 &amp;lt;===&amp;gt; 53&lt;/h3&gt;
&lt;p&gt;This is Log A from node 61 (Master, BBBBP, DD:D3:16:3A:6C:1B)
This node has another connection to Node 62 which is not shown.
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/node61log.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;This is Log B from node 53 (Slave, BBBBF,  EF:45:B0:9A:69:77)
This node has no other connections.
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/node53log.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;This is the Wireshark log from this connection:
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0513.wireshark.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Please note that there is an offset of about 18 seconds between my log and wireshark. But the screenshots show the same events.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Found in Beaconlog
&lt;ul&gt;
&lt;li&gt;@708sec, node 61 stops sending packets and has a GATTC_EVT_TIMEOUT 30 sec later because of no ACK&lt;/li&gt;
&lt;li&gt;Last packet from 61 to 53 is 69:3E:00:00:00:03:02:04:C1:01:AB:F8:01:BE:FB:01:AF:FC:01:BD&lt;/li&gt;
&lt;li&gt;The next packet (69:C9:01:B1:A3:01:BB:3D:00:B7:C0:01:C1:C8:01:AD:F7:01:BE:F9) is not ACKED&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion from Wireshark dump:
&lt;ul&gt;
&lt;li&gt;Packet 15363 from Master is a WRITE_REQ but the SoftDevice does not wait for an Ack&lt;/li&gt;
&lt;li&gt;Packet 15365 from Master is the next WRITE_REQ with the next data, but should not have been sent&lt;/li&gt;
&lt;li&gt;Slave sends an ACK in 15368&lt;/li&gt;
&lt;li&gt;Master sends another WRITE_REQ in 15396 which is also the last packet that is reported as sent by the stack, but an ACK is never received&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I attached the Wireshark log here:&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/53-BBBBF-EF.45.pcapng"&gt;53 BBBBF EF.45.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Could this error result from my code or is this an error from the SoftDevice?&lt;/p&gt;
&lt;p&gt;I could send you my firmware, but you need a few beacons (I used 8) to reproduce the error in a short time. I had 8 disconnections of this type in 30 minutes. I am currently tracking down another of these losses to find out if it follows the exact same pattern.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;EDIT:
I was able to track down another incident. The beacon logs look the same, at one point, the communication stalls. In the Wireshark log, it looks similar but there is a packet that was not seen in the other dump:&lt;/p&gt;
&lt;h3&gt;54 &amp;lt;==&amp;gt; 507&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/wireshark2.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Here the download: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/507-BBBTK-D0.9C.pcapng"&gt;507 BBBTK D0.9C.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here are the notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;packet 21252@1072sec: CONNECT REQ&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;packet 36095@1800sec: Master sends another WRITE_REQ without having received a WRITE_RSP&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Instead the Slave sent a Connection oriented channel??&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;packet 36619@1830sec: LL_TERMINATE which was triggered by my implementation as a reaction to the GATTC_EVT_TIMEOUT&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Found in log&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;54 is connected to 508 additionaly&lt;/li&gt;
&lt;li&gt;507 is connected to 61 additionaly&lt;/li&gt;
&lt;li&gt;54 receives the GATTC_EVT_TIMEOUT&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the sake of completenes, here are my node logs:&lt;/p&gt;
&lt;p&gt;Node 54:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/node54log2.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Node 507:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/node507log2.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77354?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2017 09:40:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db3eb7c3-ab86-47cd-a2ef-9592821a5d95</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Marius,&lt;/p&gt;
&lt;p&gt;Could you summarize the issue to make it a little bit clearer.&lt;/p&gt;
&lt;p&gt;We are dealing with the issue with just one particular board or it happens on other boards also ?
How often do you see the issue ?&lt;/p&gt;
&lt;p&gt;We need to narrow down the issue and find a way to reproduce it in house here.&lt;/p&gt;
&lt;p&gt;If you test with only 1 pair of devices (one connection at a time) can you reproduce the issue ?&lt;/p&gt;
&lt;p&gt;Please try to let the disconnection occur normally on the peripheral side and check the disconnected reason.&lt;/p&gt;
&lt;p&gt;If you have, please send other sniffer trace that captured the issue when it happens. Then we could be able to find a pattern. I suspecting it was the issue when a write response comes with a write request in a same connection event.&lt;/p&gt;
&lt;p&gt;Regarding your question, if you are too slow to pull all event from event buffer, the softdevice will NACK the packet. But there will still be packets from slave, not just stalled like what we see here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77357?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 20:50:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:166d3b95-6f08-4b0f-9465-b5b492c129a8</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;What would happen if I were to slow to fetch all events from the event buffer? Would a BLE_GATTS_EVT_WRITE get lost inbetween and would never be answered by the SoftDevice? I have added two logs here from two connected nodes. Each of the nodes has other connections, but I filtered the log to show only the communication between the two. (TX_COMPLETE is generic though).&lt;/p&gt;
&lt;p&gt;Log A:
&lt;a href="http://i.imgur.com/bgdIyoN.png"&gt;http://i.imgur.com/bgdIyoN.png&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Log B:
&lt;a href="http://i.imgur.com/Bi7FMXZ.png"&gt;http://i.imgur.com/Bi7FMXZ.png&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At one point, node A sends a packet (marked with (4) at the beginning of the line), but node B does never receive this packet. Nor does it receive any BLE_GATTS_EVT_WRITE event. The WRITE_RSP after (4) is just the current event that is being processed, it is not a write response to this very packet. I read all coming events.&lt;/p&gt;
&lt;p&gt;After this, the connection is ended 30 seconds later with a BLE_GATTC_EVT_TIMEOUT. Any clues how I could proceed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77356?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 17:35:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56161886-e229-403f-8c1b-3d2a27841575</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;Nothing special from the outside, a developer dongle just like the others, but even after reflashing, it has these kind of connections problems which I cannot figure out.&lt;/p&gt;
&lt;p&gt;I only have to plug it in and have another beacon around and they will connect, but the connection will break.&lt;/p&gt;
&lt;p&gt;I will test with one pair of devices tomorrow and post the results. I do the disconnection manually after two seconds because that is part of the handshake. So I get local and remote host disconnect. I could remove this timeout and see what the disconnect reason will be, but I gues it will be a GATTC_EVT_TIMEOUT, the same problem that I have with my other beacons.&lt;/p&gt;
&lt;p&gt;I do not use slave latency.&lt;/p&gt;
&lt;p&gt;I do not use special interrupts, I use Uart and Button interrupts, but these are lower priority.&lt;/p&gt;
&lt;p&gt;I do also pull all events and other following events are processed happily. I have many logs now which I am analyzing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77353?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 12:58:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6df3ac06-9d80-4a79-b735-e1db5637182e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Marius,&lt;/p&gt;
&lt;p&gt;You mentioned &lt;code&gt;I do have one beacon that will produce a similar fault very realiable&lt;/code&gt; what is special aabout that beacon  ?&lt;/p&gt;
&lt;p&gt;Is it easy to reproduce the issue on the beacon ?&lt;/p&gt;
&lt;p&gt;If you only test with 1 pair of device would that happen?&lt;/p&gt;
&lt;p&gt;If there is no assertion or hardfault, I assume you will receive DISCONNECTED event , could you check which is the disconnected reason?&lt;/p&gt;
&lt;p&gt;Do you have any slave latency on the peripheral side ?&lt;/p&gt;
&lt;p&gt;Do you have any interrupt or other thing that may block the BLE events to be handled in the application ? If you failed in pulling out the BLE event from the stack, it may run out of buffer and can&amp;#39;t process the write request.&lt;/p&gt;
&lt;p&gt;Regarding your question, the softdevice always prepares what it plan to send in the next connection event prior to the event. In this case, the slave has nothing to send to the master, so it simply sends empty PDU. You can find which packet are in same connection event by looking either at the channel the packets are in, or you can look at the delta time end to start between packets.&lt;/p&gt;
&lt;p&gt;If you can provide a simplified code that can reproduce the issue, it would be very helpful&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77355?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 10:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7684ef0-f947-420e-9c7f-39a8ef37f8cd</guid><dc:creator>Marius Heil</dc:creator><description>&lt;p&gt;Hi, i uploaded it here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www112.zippyshare.com/v/kbCqLcZu/file.html"&gt;www112.zippyshare.com/.../file.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The slave did not crash, there was no hardfault or anything. I had my UART logger open. The slave ran into a handshake timeout (the packets you are seeing are my custom handshake) and then it continued to connect to other devices with the same result.&lt;/p&gt;
&lt;p&gt;Interesting, why are 154 and 155 in the same event if only an empty PDU is sent? I use one handle for communication purpose. Whatever is written to this handle is used as a kind of serial-data transfer. It will trigger a handler on the node that will process the message.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE_GATTC_EVT_TIMEOUT: Possible causes?</title><link>https://devzone.nordicsemi.com/thread/77352?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 10:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d356c7db-040a-4798-8d37-79c120896910</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Marius,&lt;/p&gt;
&lt;p&gt;Could you upload the full trace ?&lt;/p&gt;
&lt;p&gt;From the screenshot what I can see is that the Slave stalled after the a few ms after the request. I suspecting a hardfault crashed the Slave and it might be reset at that point already.&lt;/p&gt;
&lt;p&gt;EmptyPDU at packet 155 is normal. Not that #154 and #155 are in the same connection event. The slave can only response to the write request in the next connection event.&lt;/p&gt;
&lt;p&gt;There is one interesting thing is that #154 and #161 both are write request to handle 0x0e but one is to the handle on the server on the Slave and the other is to the server on the Master, respectively.&lt;/p&gt;
&lt;p&gt;I would need the full sniffer trace to investigate more. I suggest you to check if there is any assertion or hardfault occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>