<?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>ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68118/error-7-nrf_error_invalid_param-with-custom-service-for-ble</link><description>Hello, 
 I use the default ble_template application from the SDK and download a BLE custom service template from here to add it to the template code (as described in the README). 
 
 In SES I also changed the RAM location and the RAM size in the linker</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Nov 2020 13:47:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68118/error-7-nrf_error_invalid_param-with-custom-service-for-ble" /><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/280914?ContentTypeID=1</link><pubDate>Thu, 19 Nov 2020 13:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63cfbbaa-8e1e-472e-b1b7-d75adc55714c</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Daniel,&lt;br /&gt;&lt;br /&gt;Thank you for your patience.&lt;br /&gt;&lt;br /&gt;I took a look at your code, and it seems that it fails when trying to encode the uuid to be put in the scan response packet.&lt;br /&gt;Upon closer inspection, this happens because you are calling&amp;nbsp;&lt;em&gt;advertising_init&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt;before calling&amp;nbsp;&lt;em&gt;services_init&lt;/em&gt; - in which the uuid is encoded and provided to the SoftDevice.&lt;br /&gt;So thus it is encoded incorrectly, and which fails the advertising initialization.&lt;br /&gt;Try changing places of the&amp;nbsp;&lt;em&gt;services_init&amp;nbsp;&lt;/em&gt;and the&amp;nbsp;&lt;em&gt;advertising_init&lt;/em&gt; lines of your main function, and see if this does not resolve your issue.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279542?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 15:15:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:293b5498-d9d6-4d84-9e39-097b763a2ee4</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;sure. Please take a look at the attachments.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7848.ble_5F00_app_5F00_template.zip"&gt;devzone.nordicsemi.com/.../7848.ble_5F00_app_5F00_template.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279520?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 14:22:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc3d2144-b5d5-48cf-9a6c-8a8ce677df7e</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Kampino"]yes, it is the same error. Again on &amp;quot;ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);&amp;quot;&lt;br /&gt;I only use a custom UUID and the code from the example. Please see the snipped below[/quote]
&lt;p&gt;Strange. What is your BLE_UUID_OUR_SERVICE defined as?&lt;br /&gt;Could I ask you to share the entire project code with me, as a .zip file here on DevZone so I may take a look?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279330?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 15:51:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddc3bac3-0e80-40ce-aa21-0c277cad8500</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;yes, it is the same error. Again on &amp;quot;ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);&amp;quot;&lt;br /&gt;I only use a custom UUID and the code from the example. Please see the snipped below&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static ble_uuid_t m_adv_uuids[] =                                               /**&amp;lt; Universally unique service identifiers. */
{
    {
        BLE_UUID_OUR_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN
    }
};

static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279303?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 14:32:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eee66f8-7782-466e-ac12-a1c72c005868</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Kampino,&lt;/p&gt;
[quote user="Kampino"]I have read the linked tutorial and restart my work with a new ble_template project. Steps 5 + 6 results in the same error.[/quote]
&lt;p&gt;Are you getting the same NRF_ERROR_INVALID_PARAM error when you follow the tutorial? That is very strange indeed.&lt;br /&gt;What is the current size of your advertising data and scan response data?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279097?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 18:19:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2cb6f22-a20f-41f8-8a94-7bdf81fab336</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;I have read the linked tutorial and restart my work with a new ble_template project. Steps 5 + 6 results in the same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279074?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 15:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22487469-c460-4fe2-a2f0-c04087e79f83</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hey Karl,&lt;/p&gt;
&lt;p&gt;thank you for the answer. I will check your link from below and give you an update tomorrow &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279057?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 14:48:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4324fcbd-946a-40f2-a5aa-c08656a903e1</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Please see &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial"&gt;the beginner&amp;#39;s service tutorial&lt;/a&gt; by my colleague for a more detailed description of the theory and implementation of scan response data.&lt;br /&gt;The tutorial also demonstrates how you could setup and use scan response data in Step 6.&lt;br /&gt;&lt;br /&gt;Hope this helps! &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279056?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 14:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e6e3526-d744-4ec5-b7e6-ac2122e62f86</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Kampino"]Can you give me a more detailed explanation about this please?[/quote]
&lt;p&gt;Are you familiar with the Scan Response in general, or are you asking how to implement it specifically?&lt;br /&gt;The scan response is a secondary advertising packet - like an extension - that is sent upon receiving a SCAN_REQ, in which the central asks for a SCAN_RSP, containing additional advertising data.&lt;br /&gt;&lt;br /&gt;Since you are using the Advertising module, you may just add scan response data exactly as you are adding advertising data right now - by setting the the&amp;nbsp;&lt;em&gt;srdata&lt;/em&gt;&amp;nbsp;field of the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fstructble__advertising__init__t.html"&gt;ble_advertising_init_t&lt;/a&gt;&amp;nbsp;structure you are already passing to your &lt;em&gt;ble_advertising_init&lt;/em&gt; function.&lt;br /&gt;&lt;br /&gt;So, instead of including multiple UUID&amp;#39;s in your&amp;nbsp;&lt;em&gt;advertising&lt;/em&gt; data, you may place some of them in your&amp;nbsp;&lt;em&gt;scan response&lt;/em&gt;&amp;nbsp;data&lt;em&gt;&amp;nbsp;&lt;/em&gt;instead.&lt;br /&gt;&lt;br /&gt;Does this make things more clear, or is there something you would like me to explain in more detail?&lt;br /&gt;Please let me know if anything still should be unclear.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279042?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 14:21:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f63bb94c-a050-483e-9a55-c4bd8e3eb5d1</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;I will check this after. What do you mean with&lt;/p&gt;
&lt;p&gt;&amp;quot;Please try to move one of your UUID&amp;#39;s to the scan response, and see if this resolves your issue.&amp;quot;&lt;br /&gt;&lt;br /&gt;Can you give me a more detailed explanation about this please?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279041?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 14:18:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a85406b-a4e9-435b-9d74-64679dc8cdf3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again Kampino,&lt;br /&gt;&lt;br /&gt;What is the length of your current advertising packet? Does it still exceed 31 bytes? Keep in mind that each field required 2 bytes overhead ( 1 for&amp;nbsp;&lt;em&gt;type&lt;/em&gt; and 1 for&amp;nbsp;&lt;em&gt;length&lt;/em&gt;).&amp;nbsp;Please try to move one of your UUID&amp;#39;s to the scan response, and see if this resolves your issue.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279037?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 14:09:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa6840a1-ed49-4e06-87e6-8d835daa2500</guid><dc:creator>Kampino</dc:creator><description>&lt;p&gt;Hello Karl,&lt;/p&gt;
&lt;p&gt;I have changed the name to &amp;quot;Dev&amp;quot;, but the error is still the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ERROR 7 [NRF_ERROR_INVALID_PARAM]  with custom service for BLE</title><link>https://devzone.nordicsemi.com/thread/279025?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 13:51:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f485f6d-a315-4e71-a904-d0e68ef534cd</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]But I got the following error message when try to run the code[/quote][quote user=""]So what is wrong here?[/quote]
&lt;p&gt;Looking at line 638 ( as pointed out in the error message ) we find the APP_ERROR_CHECK with the error code returned from &lt;em&gt;ble_advertising_init&amp;nbsp;&lt;/em&gt;function. Looking at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__ble__advertising.html&amp;amp;anchor=gabbdf62a76d64fc8d5e5b0d183d3c0fa7"&gt;ble_advertising_init API Reference&lt;/a&gt;&amp;nbsp;yields the following exempt:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="1" rowspan="1"&gt;NRF_ERROR_INVALID_PARAM&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;If the advertising configuration in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;p_init&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is invalid.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;My guess here is that you are trying to include more than the possible 31 bytes into your advertising.&lt;br /&gt;To resolve this, I would recommend that you cut down on the device name - which right now is trying to configure advertising with full name, 15 + 2 = 17 bytes, just for the name - and move one or both uuid&amp;#39;s to your scan response instead.&lt;br /&gt;&lt;br /&gt;Please try this, and see if it resolves your issue.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>