<?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>sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88719/sd_ble_gap_device_name_set-returning-0x7-with-any-parameters</link><description>I&amp;#39;m using modules from minew, those are MS50SFB2 based on nRF52810 and developing in nRF5_SDK_17.1.0_ddde560 and segger studio 6.30 on windows 10. 
 I was trying some examples on pca10040e, and i just hit an wall in the ble_app_blinky. 
 While running</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 11 Jun 2022 10:53:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88719/sd_ble_gap_device_name_set-returning-0x7-with-any-parameters" /><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371972?ContentTypeID=1</link><pubDate>Sat, 11 Jun 2022 10:53:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24ceb2e8-3d47-4335-9aae-4f5cd39ca7ff</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Hey All,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve found a different solution that appeals to me. In the file &lt;code&gt;nrf_svc.h&lt;/code&gt; you will find following wrapper:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SVCALL(number, return_type, signature)          \
  _Pragma(&amp;quot;GCC diagnostic push&amp;quot;)                        \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wreturn-type\&amp;quot;&amp;quot;)   \
  __attribute__((naked))                                \
  __attribute__((unused))                               \
  static return_type signature                          \
  {                                                     \
    __asm(                                              \
        &amp;quot;svc %0\n&amp;quot;                                      \
        &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (GCC_CAST_CPP number) : &amp;quot;r0&amp;quot;   \
    );                                                  \
  }                                                     \
  _Pragma(&amp;quot;GCC diagnostic pop&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The functions of the softdevice (SD) seem to always be called over SVCALL. So, since I want my own code to be optimized in release mode, but the calls to the SD doesn&amp;#39;t seem to work when the code is optimized, I hacked in a single line of code &lt;code&gt;__attribute__((optimize(&amp;quot;O0&amp;quot;)))&lt;/code&gt;, see:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SVCALL(number, return_type, signature)          \
  _Pragma(&amp;quot;GCC diagnostic push&amp;quot;)                        \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wreturn-type\&amp;quot;&amp;quot;)   \
  __attribute__((naked))                                \
  __attribute__((unused))                               \
  __attribute__((optimize(&amp;quot;O0&amp;quot;)))                       \
  static return_type signature                          \
  {                                                     \
    __asm(                                              \
        &amp;quot;svc %0\n&amp;quot;                                      \
        &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (GCC_CAST_CPP number) : &amp;quot;r0&amp;quot;   \
    );                                                  \
  }                                                     \
  _Pragma(&amp;quot;GCC diagnostic pop&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;That way, the calls to the SD work and my parts of the code remain optimized.&lt;/p&gt;
&lt;p&gt;That works well with SEGGER Embedded Studio v6.30 along with nRF5 SDK 17.1 on an nRF52840 DK.&lt;/p&gt;
&lt;p&gt;Best,&lt;br /&gt;Tamas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371962?ContentTypeID=1</link><pubDate>Fri, 10 Jun 2022 23:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:480064c5-8d11-4069-8488-904deec3744f</guid><dc:creator>matheus almeida</dc:creator><description>&lt;p&gt;Heys NewtoM, i managed to &amp;quot;solve&amp;quot; the issue here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/88778/wierd-error-7-happening-in-init"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/88778/wierd-error-7-happening-in-init&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;TLDR: Rollback to Segger studio &lt;span&gt;5.70a&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thougt the issue might be something deeper because if i swap the compiler from GGC (deffault), to SEGGER it got the code partially working (it crashes during the connection).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371961?ContentTypeID=1</link><pubDate>Fri, 10 Jun 2022 23:19:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec335fcd-7c0d-40d9-9697-93a26f3fa180</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;I see similar behavior with Segger Embedded Studio v6.30 on Windows 11 with SDK 17.1 when trying to run a program based on the ble_peripheral\ble_app_uart example. Interestingly, sd_ble_gap_device_name_set() only returns 0x7 if the code was compiled in release mode. If compiled in debug mode, the return value is 0.&lt;/p&gt;
&lt;p&gt;When trying around with RTT viewer, I can see following messages:&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; nrf_sdh_ble: sd_ble_cfg_set() returned NRF_ERROR_INVALID_PARAM when attempting to set BLE_CONN_CFG_GAP.&lt;br /&gt;&amp;lt;error&amp;gt; nrf_sdh_ble: sd_ble_cfg_set() returned NRF_ERROR_INVALID_PARAM when attempting to set BLE_GAP_CFG_ROLE_COUNT.&lt;br /&gt;&amp;lt;error&amp;gt; nrf_sdh_ble: sd_ble_cfg_set() returned NRF_ERROR_INVALID_LENGTH when attempting to set BLE_GATTS_CFG_ATTR_TAB_SIZE.&lt;br /&gt;&amp;lt;error&amp;gt; nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.&lt;br /&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;/p&gt;
&lt;p&gt;But again, this only happens if built in release mode (optimization being above level 0). Other settings are the same for debug and release modes.&lt;/p&gt;
&lt;p&gt;I am using the nRF52840 DK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371567?ContentTypeID=1</link><pubDate>Thu, 09 Jun 2022 08:02:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2b73c58-9c65-453d-a49c-cbe01b7b10d7</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Okay, from seeing the error I assumed you might have changed the device name to an invalid value, but I guess not. I&amp;#39;m not able to reproduce this error on the nRF52 DK I have here on my end, so it must be related to moving to the nRF52810 HW. If you&amp;#39;re running the PCA10040e version of the example the only change necessary should be to&amp;nbsp;&lt;span&gt;remove the&amp;nbsp;&lt;/span&gt;&lt;code&gt;DEVELOP_IN_NRF52832&lt;/code&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;code&gt;NRFX_COREDEP_DELAY_US_LOOP_CYCLES&lt;/code&gt;&lt;span&gt;&amp;nbsp;defines from the compile flags in your IDE. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fnrf52810_user_guide.html&amp;amp;anchor=ug_52810_emulated_project"&gt;Here is the user guide for transferring projects to nRF52810 HW&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Are you certain the INVALID_PARAM error is coming from the&amp;nbsp;sd_ble_gap_device_name_set() function? Because the only parameters are the security mode (should be&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_OPEN&amp;nbsp;by default), DEVICE_NAME, and the length for the DEVICE_NAME.&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;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371461?ContentTypeID=1</link><pubDate>Wed, 08 Jun 2022 14:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6118f912-deb6-472f-88a9-7fcf398359bd</guid><dc:creator>matheus almeida</dc:creator><description>&lt;p&gt;Hello Simon,&lt;/p&gt;
&lt;p&gt;So, as i mentioned before, that was the example that came with the SDK version 17.1.0, at first i havent changed anything. Just after debugging i tried to change values. The name is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define LEDBUTTON_BUTTON                BSP_BUTTON_0                            /**&amp;lt; Button that will trigger the notification event with the LED Button Service */

#define DEVICE_NAME                     &amp;quot;Nordic_Blinky&amp;quot;                         /**&amp;lt; Name of device. Will be included in the advertising data. */

#define APP_BLE_OBSERVER_PRIO           3                                       /**&amp;lt; Application&amp;#39;s BLE observer priority. You shouldn&amp;#39;t need to modify this value. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Which is the default value declared on line 77 on the main.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gap_device_name_set returning 0x7 with any parameters</title><link>https://devzone.nordicsemi.com/thread/371402?ContentTypeID=1</link><pubDate>Wed, 08 Jun 2022 12:37:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fc5ed85-e72f-4ea7-a4e2-753283bdd598</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;If&amp;nbsp;sd_ble_gap_device_name_set() returns an &amp;quot;INVALID PARAM&amp;quot; error, that does indeed point to one of the parameters in the function not being vaild. What have you set your DEVICE_NAME as exactly? This should be set somewhere in the top of your application as a define.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>