<?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>Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32951/hardfault-after-ble-connection-in-ble-with-adc-app</link><description>Hi, 
 I&amp;#39;m using SDK 14. I started from ble_uart application, and to use ADC as well I ported ble_app_uart__saadc_timer_driven__scan_mode (SDK 13) to SDK 14 (made changes in main.c, sdk_config.h, Makefile). It compiles and runs fine. 
 Here&amp;#39;s an example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Apr 2018 09:32:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32951/hardfault-after-ble-connection-in-ble-with-adc-app" /><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126785?ContentTypeID=1</link><pubDate>Wed, 04 Apr 2018 09:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db389f01-7d57-4d73-8cd7-de285d20231f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;&lt;code&gt;ble_nus_string_send&lt;/code&gt;&amp;nbsp;will return&amp;nbsp;&lt;code&gt;NRF_ERROR_INVALID_PARAM&lt;/code&gt; if parameter&amp;nbsp;&lt;code&gt;p_length&lt;/code&gt; is greater than &lt;code&gt;BLE_NUS_MAX_DATA_LEN&lt;/code&gt;, or if an invalid parameter is passed to&amp;nbsp;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db"&gt;sd_ble_gatts_hvx&lt;/a&gt;. Please check which length you are passing to the function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126491?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 11:16:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1aa627d-86ec-45aa-934a-e5287a9331c1</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;As I said, it gave&amp;nbsp;&lt;strong&gt;NRF_ERROR_INVALID_PARAM&lt;/strong&gt;, and not&amp;nbsp;&lt;strong&gt;TX buffer full&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126490?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 11:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c60f616-cf46-4aa5-a4fd-593494964a64</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;The ble_nus_string_send() function can give you a &amp;quot;TX buffer full&amp;quot; return code for example, which you should handle &lt;em&gt;somehow&lt;/em&gt;. Usually that means redesigning some stuff using FIFOs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126488?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 10:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99530c2e-0562-440b-96ff-602f2e80fcb3</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;This was happening in the function &lt;strong&gt;saadc_callback()&lt;/strong&gt;&amp;nbsp;after executing the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;err_code = ble_nus_string_send(&amp;amp;m_nus, value, bytes_to_send);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Which tries to send data via BLE. Currently I&amp;#39;m sending data in another function outside of&amp;nbsp;&lt;strong&gt;saadc_callback()&lt;/strong&gt; and it&amp;#39;s working.&lt;/p&gt;
&lt;p&gt;But you&amp;#39;re right; the root cause of the problem should be fixed. I&amp;#39;m not sure where this is coming from though so I think I&amp;#39;ll wait for responses...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126487?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 10:28:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e2cd6eb-201a-4fba-b977-39ce9e7719ba</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;You should rather fix the call that generated the error code...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126486?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 10:26:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99bb2ee7-3adc-4919-b252-a6f88c03e95e</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Good point!&lt;br /&gt;It was coming from&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;err_code&lt;/strong&gt; was equal&amp;nbsp;&lt;strong&gt;NRF_ERROR_INVALID_PARAM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure how this is causing hard fault but disabling this error check solved the problem.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault after BLE connection, in BLE with ADC app</title><link>https://devzone.nordicsemi.com/thread/126484?ContentTypeID=1</link><pubDate>Sun, 01 Apr 2018 10:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75285870-50c7-4adf-8cc1-01dafd9d5c2c</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Why dont&amp;#39;t you just look at the call stack (gdb: &amp;quot;bt&amp;quot; command)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>