<?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>RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40663/ram-requirements-per-central-link</link><description>Hello, 
 I have an application that is meant to be used mainly as a peripheral. I&amp;#39;m now exploring options to expand functionality via 3rd-party accessories. For this, I need to use the central role. 
 My question is how much RAM should an extra concurrent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Nov 2018 12:19:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40663/ram-requirements-per-central-link" /><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158391?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 12:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:210ba1d5-c47a-405b-bef8-c52ac8fd9d0a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Andy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;happy to hear that you managed to solve the data length issue with multiple roles. I will add this as a feature request in our internal development database.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Bjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158371?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 11:02:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:481d3d7d-0a30-41f0-9e51-c8404b529a09</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;So I actually went away and implemented the two separate data lengths and it works now :) I hope this change can be included in a future SDK!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158361?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 10:28:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b75715c4-6dac-4ad7-aa76-9a4974ffadf0</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Hi Bjorn,&lt;/p&gt;
&lt;p&gt;So I implemented what you mentioned and it seems to be working nicely :) I could reduce the RAM requirements for each additional central link to 1628 bytes.&lt;/p&gt;
&lt;p&gt;However, I ran into issues when connecting to another peripheral using the central role. These issues are specific to the nrf_ble_gatt module. I run into errors because the module is trying to use a&amp;nbsp;larger MTU and a longer data length than what I have allocated memory for.&lt;/p&gt;
&lt;p&gt;The first issue I have is that the module tries to set an MTU of 247 for my central connections. This is because the module initializes the desired MTU to the MAX MTU SIZE definition in sdk_config.h. This is an easy fix because I can just call&amp;nbsp;&lt;strong&gt;nrf_ble_gatt_att_mtu_central_set&lt;/strong&gt; and override the setting.&lt;/p&gt;
&lt;p&gt;The second issue I have is that the module also tries to set the data length to 251. There aren&amp;#39;t separate peripheral/central data lengths. So if I call&amp;nbsp;&lt;strong&gt;nrf_ble_gatt_data_length_set&lt;/strong&gt; to set it to 23 for my central links, this value would be set also for future peripheral connections. I think there should be separate settings just like for the MTU. Consider this a feature request :)&lt;/p&gt;
&lt;p&gt;Anyway, do you have any suggestions on how to tackle this issue?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158236?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 15:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1f8eabc-d542-4ece-818c-8c874b0a0afe</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help! Let me know if you run into any issues.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158232?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 15:39:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0694d395-162d-42ab-bfdb-7c56c4f1c28c</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;That&amp;#39;s great! Thanks for your support as always :) I&amp;#39;ll implement that and report back when I get some results. I&amp;#39;ll mark the question as answered then.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158231?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 15:37:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b01e4399-5426-43e7-ab64-d0e2f83cd2ef</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, you can create two different SoftDevice configurations, one for the peripheral role and for the central role.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You use&amp;nbsp;sd_ble_cfg_set to set the configuration and the&amp;nbsp;ble_cfg.conn_cfg.conn_cfg_tag field to determine which configuration number that is being set. So for configuration number 1, you can set the ATT MTU to 247 and the peripheral role count to 1. For the seconds configuration, number 2, you can set the ATT&amp;nbsp; MTU to 23 and the central role count to 8.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you connect to the peripherals using the central role you pass the configuration number in the&amp;nbsp;&lt;strong&gt;sd_ble_gap_connect call, i.e.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sd_ble_gap_connect&lt;/strong&gt;(ble_gap_addr_t const *p_peer_addr, ble_gap_scan_params_t const *p_scan_params, ble_gap_conn_params_t const *p_conn_params, uint8_t conn_cfg_tag));&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158222?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 14:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee4b8afe-59e4-438e-9031-b97d3006b676</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I am setting it to 247. Is it possible somehow to have an MTU of 23 for the central roles? I need a high throughput for my peripheral, but my accessories (central links) have a very low priority which I can handle with a small MTU and long connection intervals.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158219?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 14:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9585b92-21f9-4c25-8839-6dea74d5935d</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Andy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;it appears that I was mistaken, the Attribute table size does not increase the RAM required for additional connections, its the ATT MTU Size, Write Command Queue and HVN Queue that increase the RAM usage for each additional connection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is your ATT MTU size? If I set it to 247( the maximum size our SDs allow) then I get a similar RAM increase per connection as you have observed, i.e. 0x1238 per connection added.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158189?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 13:28:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a71ac5e7-609f-4d88-ab42-016b7ad3c8ec</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;I increased the ATTR TAB SIZE because I need more RAM allocated to the SoftDevice for it to handle the 70 characteristics.&amp;nbsp;If I understand what you&amp;#39;re saying, each additional role will be created with enough RAM to handle 70 characteristics as well?&lt;/p&gt;
&lt;p&gt;Is there any way to isolate this? Did I maybe misunderstand the ATTR TAB SIZE attribute and I need to give the RAM for my characteristics elsewhere?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158181?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 13:08:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4b94f02-d944-4250-be10-8b39ce977737</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Andy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;parameters like ATT MTU size&amp;nbsp;and GATT Table size&amp;nbsp;will affect the RAM usage of each additional role. I have used the default values in the&amp;nbsp;&lt;span&gt;ble_app_multilink_central, i.e.&amp;nbsp;NRF_SDH_BLE_GATT_MAX_MTU_SIZE = 23 and&amp;nbsp;NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE =&amp;nbsp;1408.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I see that you&amp;#39;re increasing the GATT table size with 0x1100 compared to the default 1408( if you have not changed it). Make sure that you do not set this higher that you need strictly need to.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158152?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 11:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:433b8b44-561c-466d-a692-c01ca123f0c4</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Hi Bjorn,&lt;/p&gt;
&lt;p&gt;Good to know that the RAM requirements can be lower!&lt;/p&gt;
&lt;p&gt;My initialization method looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_stack_init(void) {
	ret_code_t err_code;

	// Initialize the SoftDevice handler module.
	err_code = nrf_sdh_enable_request();
	APP_ERROR_CHECK(err_code);

	// Fetch the start address of the application RAM.
	uint32_t ram_start = 0;
	err_code = nrf_sdh_ble_app_ram_start_get(&amp;amp;ram_start);
	APP_ERROR_CHECK(err_code);

	// Overwrite some of the default configurations for the BLE stack.
	ble_cfg_t ble_cfg;

	memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
	ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = CUSTOM_UUID_COUNT;

	err_code = sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &amp;amp;ble_cfg, ram_start);
	APP_ERROR_CHECK(err_code);

	memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
	// TODO: change this value if you get the NRF_ERROR_NO_MEM
	// If you change the size, you need to change the RAM settings in the linker file
	ble_cfg.gatts_cfg.attr_tab_size.attr_tab_size = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT + BLE_GATTS_ATTR_TAB_SIZE_MIN + 0x1100;
	err_code = sd_ble_cfg_set(BLE_GATTS_CFG_ATTR_TAB_SIZE, &amp;amp;ble_cfg, ram_start);
	APP_ERROR_CHECK(err_code);

	// Configure the maximum number of connections.
	memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
	ble_cfg.gap_cfg.role_count_cfg.periph_role_count  = NRF_SDH_BLE_PERIPHERAL_LINK_COUNT;
	ble_cfg.gap_cfg.role_count_cfg.central_role_count = NRF_SDH_BLE_CENTRAL_LINK_COUNT;
	ble_cfg.gap_cfg.role_count_cfg.central_sec_count  = NRF_SDH_BLE_CENTRAL_LINK_COUNT;
	err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &amp;amp;ble_cfg, ram_start);
	APP_ERROR_CHECK(err_code);

	// Configure the maximum ATT MTU.
	memset(&amp;amp;ble_cfg, 0x00, sizeof(ble_cfg));
	ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = NRF_SDH_BLE_GATT_MAX_MTU_SIZE;
	ble_cfg.conn_cfg.conn_cfg_tag                 = APP_BLE_CONN_CFG_TAG;
	err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATT, &amp;amp;ble_cfg, ram_start);
	APP_ERROR_CHECK(err_code);

	memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));
	ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count     = NRF_BLE_LINK_COUNT;
	ble_cfg.conn_cfg.params.gap_conn_cfg.event_length   = NRF_SDH_BLE_GAP_EVENT_LENGTH;
	ble_cfg.conn_cfg.conn_cfg_tag                       = APP_BLE_CONN_CFG_TAG;
	err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &amp;amp;ble_cfg, ram_start);
	APP_ERROR_CHECK(err_code);

	// Enable BLE stack.
	err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
	APP_ERROR_CHECK(err_code);

	// Register a handler for BLE events.
	NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM requirements per central link?</title><link>https://devzone.nordicsemi.com/thread/158141?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 10:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57bbc85a-42de-4efe-b2cc-a9f1e077a431</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Andy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did a quick test with the ble_app_multilink_central example in SDK v15.0.0 where I set the&amp;nbsp;NRF_SDH_BLE_TOTAL_LINK_COUNT and NRF_SDH_BLE_CENTRAL_LINK_COUNT to 1&amp;nbsp; and then added more centrals one by one.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I got the following app_ram_start address from sd_ble_enable&lt;/p&gt;
&lt;p&gt;Central Link Count&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Application RAM Start Address&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x200021F8&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x20002758&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x2000CB8&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0x20003218&lt;/p&gt;
&lt;p&gt;Each additional central increased the RAM start address by 0x560 bytes, i.e. 1376 bytes. Are you the default configuration, i.e. calling&amp;nbsp; nrf_sdh_ble_default_cfg_set()&amp;nbsp;prior to&amp;nbsp;nrf_sdh_ble_enable() or have you modified it?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>