<?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>SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59363/softdevice-s140-l2cap-recombination</link><description>I am attempting to port a BLE application to the nRF52840. The original application used a standard HCI serial interface so I am trying to adapt that to use the Nordic SoftDevice. 
 I am trying to determine how L2CAP recombination/reassembly is performed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 May 2020 15:24:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59363/softdevice-s140-l2cap-recombination" /><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/248273?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 15:24:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c74cdb8d-6236-4ba7-9094-d48a739d9dd9</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the status update. I am happy to hear that you got everything up and running!&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/247704?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 21:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d59e759-531c-44fd-88e1-2d6d98646b08</guid><dc:creator>mnmoran</dc:creator><description>&lt;p&gt;After a month, I have succeeded in porting my HCI based Bluetooth Mesh stack to the Zephyr OS using the nRF52840. I started with the `hci_uart` example and stripped the UART code using the HCI queues directly. It required a bit of tweaking of the Zephyr HCI code to get it fully working, but I now have the system working.&lt;/p&gt;
&lt;p&gt;Thank you for the pointers,&lt;/p&gt;
&lt;p&gt;mike&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241533?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 09:16:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:144a0620-7403-475c-b74a-d0eab8d3b1bf</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From your descriptions it sounds like basing things off of Zephyr might be a good direction, as Zephyr already uses the BLE HCI protocol that your current project uses.&lt;/p&gt;
&lt;p&gt;Please note that while we have made some contributions to the Zephyr project we have not and do not currently provide support for Zephyr based projects for the nRF52 series devices. Our new SDK, the &lt;a href="https://www.nordicsemi.com/Software-and-tools/Software/nRF-Connect-SDK"&gt;nRF Connect SDK (NCS)&lt;/a&gt;, integrates Zephyr, but to date NCS only supports the nRF53 series and the nRF91 series. For nRF52 projects we therefore refer to the Zephyr community.&lt;/p&gt;
&lt;p&gt;You are of course free to ask nRF52 + BLE + Zephyr related questions here in DevZone, as other users may still give valuable help and feedback, just be aware that the Zephyr community is probably the best resource on Zephyr related matters.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241446?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 17:24:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bdce15f-58c3-48f2-85b3-a40abe32706c</guid><dc:creator>mnmoran</dc:creator><description>&lt;p&gt;Thank you &lt;a href="https://devzone.nordicsemi.com/members/wpaul"&gt;wpaul&lt;/a&gt; . You answered my question about L2CAP recombination/reassembly and more.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/tesc"&gt;tesc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I went through the process of installing Zephyr (Yikes!) and building the hci_uart example for the nrf52840_pca10056 board to track down the nordic source files for that implementation&lt;/p&gt;
&lt;p&gt;It appears that Zephyr is using the nRF5 hardware directly with no use of the SoftDevice, which to my mind is quite interesting.&lt;/p&gt;
&lt;p&gt;In particular the `subsys/bluetooth/controller` directory, all of which seems to contain that implementations from Nordic which I *assume* adapts the nRF5 to the Zephyr environment.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m going to need a lot of coffee.&lt;/p&gt;
&lt;p&gt;Please correct me if I&amp;#39;m on the wrong track.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241356?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 12:14:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d30c91c-31da-4f66-9392-4957f40a4b48</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the clarification.&lt;/p&gt;
&lt;p&gt;The L2CAP feature available through the SoftDevice is LE Credit Based Flow Control Mode, which is used for LE L2CAP connection oriented channels. For GATT based services I would strongly recommend to use the GATT implementation of the SoftDevice directly. The L2CAP API of the SoftDevice is not intended for building ATT/GATT on top of.&lt;/p&gt;
&lt;p&gt;In addition to the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.0.1%2Fmodules.html"&gt;SoftDevice API documentation&lt;/a&gt;, I recommend having a look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fs140.html"&gt;SoftDevice specification&lt;/a&gt;, of which in particular the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fble_protocol_stack%2Ffeatures_ble_protocol_stack.html"&gt;Bluetooth Low Energy features&lt;/a&gt; page should be of interest for figuring out what functionalities of the SoftDevice to use&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241244?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 21:47:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6075548-5e66-4bce-ab14-7e6089183e86</guid><dc:creator>wpaul</dc:creator><description>&lt;p&gt;I used the L2CAP support in the S140 SoftDevice in a project some time ago. You can find the source code for it here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/netik/dc27_badge/tree/master/software/firmware"&gt;https://github.com/netik/dc27_badge/tree/master/software/firmware/badge&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In particular you want to look at the ble_lld.c and ble_l2cap_lld.c modules.&lt;/p&gt;
&lt;p&gt;You do not need to manually reassemble fragments when handling L2CAP packets. The SoftDevice takes care of all that for you. This is why the data structures related to L2CAP handling don&amp;#39;t include the kinds of fields you&amp;#39;re looking for.&lt;/p&gt;
&lt;p&gt;What you do have to do is set up some L2CAP-related parameters when you initialize the SoftDevice. In my code, in ble_lld.c:bleEnable(), I do this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	/* Set L2CAP connection limits. */

	memset (&amp;amp;cfg, 0, sizeof(cfg));

	cfg.conn_cfg.conn_cfg_tag = BLE_IDES_APP_TAG;
	cfg.conn_cfg.params.l2cap_conn_cfg.rx_mps = BLE_IDES_L2CAP_MPS;
	cfg.conn_cfg.params.l2cap_conn_cfg.tx_mps = BLE_IDES_L2CAP_MPS;
	cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = 10;
	cfg.conn_cfg.params.l2cap_conn_cfg.tx_queue_size = 10;
	cfg.conn_cfg.params.l2cap_conn_cfg.ch_count = 1;

	r = sd_ble_cfg_set (BLE_CONN_CFG_L2CAP, &amp;amp;cfg, ram_start);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;BLE frames themselves are limited to about 31 bytes. The MPS value here indicates the L2CAP packet size (which I define to be 128). Each L2CAP packet is fragmented across several BLE frames. Additionally, when you create an L2CAP connection using sd_ble_l2cap_ch_connect(), you can specify an MTU. This is the largest contiguous block of data you can send using the channel in a single TX operation. The data in that transmission will be fragmented across multiple MPS-sized L2CAP packets, which in turn will be fragmented into multiple BLE frames.&lt;/p&gt;
&lt;p&gt;The reassembly of the data will be done automatically by the SoftDevice on the other end.&lt;/p&gt;
&lt;p&gt;Note that all of this is built on top of the SoftDevice&amp;#39;s own GAP implementation.&lt;/p&gt;
&lt;p&gt;Ultimately what this means is that you just get to use the L2CAP channel for exchanging unformatted data. I don&amp;#39;t think it&amp;#39;s intended as an intermediate layer for you to build your own GATTC/GATTS layer on top. The expectation is that you&amp;#39;ll use the SoftDevice&amp;#39;s GATTC/GATTS layers instead.&lt;/p&gt;
&lt;p&gt;-Bill&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241229?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 18:35:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43635ca3-b36b-4e5e-aea5-56810b26ad86</guid><dc:creator>mnmoran</dc:creator><description>&lt;p&gt;Hi Terje,&lt;/p&gt;
&lt;p&gt;I am not interested in using the nRF52 as an HCI BLE device through a serial-port. Instead, I want to port my application to run on the nRF52840 and use the SoftDevice.&lt;/p&gt;
&lt;p&gt;I have a rather large BLE application that was written against a standard HCI/serial-port. The application works well in this configuration, but I would like to port it to the nRF52840 and take advantage of the SoftDevice.&lt;/p&gt;
&lt;p&gt;The application is layered pretty well with implementation for GATT/ATT/L2CAP/HCI. I would like to &amp;quot;simply&amp;quot; replace the L2CAP and HCI layer with one written for the&amp;nbsp; SoftDevice. Obviously, my current L2CAP/HCI Host implementation&amp;nbsp; handles producing/consuming ACL packets.&lt;/p&gt;
&lt;p&gt;Also, as part of the L2CAP this layer deals with what the Bluetooth Specification calls &amp;#39;&amp;#39;recombination&amp;#39;&amp;#39; for fragmented L2CAP packets that are received. HCI ACL packets include a &amp;quot;Packet Boundary&amp;quot; field that is used in this recombination process.&lt;/p&gt;
&lt;p&gt;I cannot find any such field in the events that are returned from the SoftDevice (`BLE_L2CAP_EVT_CH_RX` ble_evt_t`), which I would expect to contain that information.&lt;/p&gt;
&lt;p&gt;I have spent days staring at the various examples, with a particular focus on the `ble_app_hrs_freertos` example.&lt;/p&gt;
&lt;p&gt;Obviously, these examples use many parts of the SoftDevice BLE stack that I do not need. For example, I already have implementations for GATT, ATT and the profiles that run on these.&lt;/p&gt;
&lt;p&gt;I have not found good documentation for how to use the SoftDevice L2CAP directly.&lt;/p&gt;
&lt;p&gt;I hope that &amp;quot;clarifies&amp;quot; my situation.&lt;/p&gt;
&lt;p&gt;regards,&lt;/p&gt;
&lt;p&gt;mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice S140 L2CAP Recombination</title><link>https://devzone.nordicsemi.com/thread/241114?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 12:10:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:907df27e-1bd9-4f81-bc7f-ce5f5699d30c</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The SoftDevice does not use the HCI defined in the Bluetooth specification, as it (simply put) implements both host and controller as one opaque unit. You interface it through the SoftDevice API (which can also be serialized, if you use the SoC running the SoftDevice for network mcu.)&lt;/p&gt;
&lt;p&gt;There is a &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fnwp_029%2FWP%2Fnwp_029%2Fintro.html"&gt;BLE HCI controller example&lt;/a&gt; which is part of the Zephyr project, that is compatible with the nRF52 series devices, if a pure Bluetooth HCI controller is what you are looking for.&lt;/p&gt;
&lt;p&gt;With a bit more information about the project, I may be able to better point you in the right direction. I am afraid it is a bit unclear to me at the moment, what you need.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>