<?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>How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72908/how-to-increase-credit-in-l2cap</link><description>Hello, 
 MCU: nRF52832; 
 SDK: 15.3; 
 Project: examples\ble_peripheral\experimental\ble_app_ots 
 nrf52832 receive data from app, communication by L2CAP, I want to increase throughput to 40kBps. 
 Now the iphone 8/xr can reach, but iphone 11/12 only</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Apr 2021 13:49:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72908/how-to-increase-credit-in-l2cap" /><item><title>RE: How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/thread/303201?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 13:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e494ca9-2150-456f-aa99-2d5ef66084c1</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Maybe this can be useful:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/65490/le-credit-based-for-l2cap-connetion-oriented-channels---initial-credit/268270#268270"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/65490/le-credit-based-for-l2cap-connetion-oriented-channels---initial-credit/268270#268270&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/thread/302119?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 11:34:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b82aae7c-d625-451b-9ef4-4962f53a05d0</guid><dc:creator>Rickon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;How can I set the credit? I set below, but credit is still&amp;nbsp; 1;&lt;/p&gt;
&lt;p&gt;How can I use *p_credits?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;sd_ble_l2cap_ch_flow_control(uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits))&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/credit-default.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/rx_5F00_queue.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/set-credit.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/thread/300629?ContentTypeID=1</link><pubDate>Thu, 18 Mar 2021 10:23:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89af67ea-1b6d-4788-9765-c2ee8f552822</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I think the entire L2CAP packet may be 251bytes*5+2bytes = 1257bytes? However since a BLE packet can only contain 251bytes, the packet is fragmented on the link, and the last 2bytes are split into a separate packet. The last packet is slightly inefficient, it would be more efficient if you reduce the L2CAP to 1255bytes.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/thread/300551?ContentTypeID=1</link><pubDate>Thu, 18 Mar 2021 02:50:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebe05865-b63e-4d4c-91c3-f14cc1e3b566</guid><dc:creator>Rickon</dc:creator><description>&lt;p&gt;Thank you for your reply. Another problem, why only 2 bytes is in the last pack, other are 251 bytes?&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/last-2byte.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to increase credit in L2CAP</title><link>https://devzone.nordicsemi.com/thread/300442?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 14:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81fcefa0-c595-4cdc-b87b-b20009695d8c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Unfortunately the nRF5 SDK OTS example is not optimized for throughput.&lt;/p&gt;
&lt;p&gt;To increase throughput I suspect one of these two must be changed, either increase queue size:&lt;br /&gt;&lt;em&gt;ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = 1; // Need to be more than 1&lt;/em&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;or&amp;nbsp;increase credits to 2, 3, or 4:&lt;br /&gt;&lt;em&gt;sd_ble_l2cap_ch_flow_control(uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits)) // with credits set to 2, 3, or 4 might be possible&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;There is a message sequence chart here showing the above:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___l2_c_a_p___c_h___f_l_o_w___c_o_n_t_r_o_l___m_s_c.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___l2_c_a_p___c_h___f_l_o_w___c_o_n_t_r_o_l___m_s_c.html&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Looking at the logs I can see that iphone 8 and 11 behave a bit differently:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3443.pastedimage1615990265286v2.png" alt=" " /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/1300.pastedimage1615990246508v1.png" alt=" " /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;It looks like the second to last packet don&amp;#39;t have the MD bit set on iphone 11, in other words it is as if the last 2bytes is not ready in the link layer of the host on iphone 11 yet, while it is ready on iphone 8. This cause the transfer to be slower on iphone 11, since it wait until next connection interval to send the last 2bytes, but I do not know why there is a difference.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Hope it helps,&lt;br /&gt;Kenneth&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>