<?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 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77142/error-8-0x8-gatt-conn-timeout-on-nrf52805</link><description>Hi, I used nRF52805 module BC805M on my customized board. I can only make the BLE connection for a few seconds or minutes. Then, the connection will be lost. Here are the Mobile nRF Connect error log and BLE sniffer log (in zip file): 
 
 After reading</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Jul 2021 22:28:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77142/error-8-0x8-gatt-conn-timeout-on-nrf52805" /><item><title>RE: Error 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/thread/319460?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 22:28:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79388f2d-f05e-46bd-a06f-8eaa19e22096</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;A good tip for debugging is to add the debug flag to preprocessor symbols and place a breakpoint in the app_error_fault_handler, that way you can see if there are any app errors.&lt;/p&gt;
&lt;p&gt;As for the lfrc, I think using the LFRC should be fine. The TWI clock is derived from the HFXO, but you might want to start the hfxo manually (by calling sd_clock_hfclk_request) for TWI, if not the SD might toggle it on/off (I am not to familiar with the driver, so it might be doing that already, but good to check).&lt;/p&gt;
&lt;p&gt;Fyi, we are beginning summer vacations, so you might get longer response times. I will be ooo for the next 4 weeks, you might want to open a new case if you cannot see any asserts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/thread/319304?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 08:20:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ec9f5f6-c489-42b6-9a32-31a8d6761165</guid><dc:creator>StevenW807</dc:creator><description>&lt;p&gt;Hi run_ar, thank&amp;nbsp;you very much for your support.&lt;/p&gt;
&lt;h2 id="mcetoc_1fa54or7c1"&gt;1)&amp;nbsp;&lt;/h2&gt;
&lt;p&gt;I have 2 PCB boards: 1 board has the nRF52805, another PCB has TWI sensors. I&amp;#39;m using 2 ADC and 1 TWI and BLE.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1fa54omkv0"&gt;2)&lt;/h2&gt;
&lt;p&gt;For the application log, do you mean to use RTT Viewer? &lt;strong&gt;I have enabled RTT and LOG functions in sdk_config.h, but nothing shows on the RTT Viewer. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;(Note: Because it&amp;#39;s a&amp;nbsp;BLE application, we cannot use SEGGER debugger function)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What do you mean by &amp;quot;debugger&amp;quot;?&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1625817855193v1.png" /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1625817873315v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1fa55dbct2"&gt;3)&amp;nbsp;&lt;/h2&gt;
&lt;p&gt;Because I don&amp;#39;t have an external clock on my PCB, so I used&amp;nbsp;the internal RC oscillator (32.768kHz). However, in my code, I used:&lt;/p&gt;
&lt;p&gt;SAADC_SAMPLE_RATE = 20ms&amp;nbsp;&lt;strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(Will it has an accuracy issue? I guess not, right?)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;many types of BLE intervals = 64ms, 20ms, 30ms, etc&lt;strong&gt; (Will it has an accuracy issue? I guess not, right?)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;timer_config.frequency = NRF_TIMER_FREQ_31250Hz;&amp;nbsp;&lt;strong&gt;(Will it has an accuracy issue? I guess not, right?)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;TWI uses 400kHz clock&lt;span style="color:#ff0000;"&gt; &lt;strong&gt;(Higher frequency than RC oscillator, I guess it causes the code issue)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And in future, I will use 14-bit oversampling for 2 SAADC.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Could&amp;nbsp;I solve the above clock issues with internal clocks?&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks again!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/thread/319135?ContentTypeID=1</link><pubDate>Thu, 08 Jul 2021 11:25:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa3a7532-6218-4dd1-b21e-b57bc36b837d</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the nRF connect log, Unfortunately it only shows me that there is a timeout, so it doesn&amp;#39;t tell me anything about what is happening in the application. Could you capture an application log? or could you connect a debugger and check if you are getting any application errors? reboots? or any other issues?&lt;/p&gt;
&lt;p&gt;could you provide a project for recreating the issue? or the part of the code where you try to send TWI data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/thread/319068?ContentTypeID=1</link><pubDate>Thu, 08 Jul 2021 07:15:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c95225dc-6d51-450d-809e-816645aae1e3</guid><dc:creator>StevenW807</dc:creator><description>&lt;p&gt;Thanks run_ar, Yes, all above 3 parameters are 0 (RC ocillator)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NRFX_CLOCK_CONFIG_LF_SRC = 0&lt;/li&gt;
&lt;li&gt;CLOCK_CONFIG_LF_SRC&lt;span&gt;&amp;nbsp;= 0&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;NRF_SDH_CLOCK_LF_SRC&lt;span&gt;&amp;nbsp;= 0&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;#39;m using a 400kHz TWI master, 2 ADC channels and BLE (i.e. Send TWI and ADC data via BLE). Although I could connect and see all data on the nRF Connect mobile App, BLE will disconnect in a few seconds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__STATIC_INLINE void data_handler(uint16_t data1, uint16_t data2)
{
     // Same data calculations and filters
}


.
.
.


void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {
        ret_code_t err_code;
        uint16_t bytes_to_send;
     
        // set buffers
        err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAADC_SAMPLES_IN_BUFFER);
        APP_ERROR_CHECK(err_code);
						
        // Get 2 ADC values
        adc_data_1 = p_event-&amp;gt;data.done.p_buffer[0];
        adc_data_2 = p_event-&amp;gt;data.done.p_buffer[1];

        // convert ADC raw data to the real data

        uint8_t nus_string[100];
        bytes_to_send = sprintf(nus_string,&amp;quot;\%.2f     %.2f    %.2f&amp;quot;, adc_data_converted_1, adc_data_converted_2, twi_data1);
        
        err_code = ble_nus_data_send(&amp;amp;m_nus, nus_string, &amp;amp;bytes_to_send, m_conn_handle);
        if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (err_code != NRF_ERROR_NOT_FOUND))
        {
            APP_ERROR_CHECK(err_code);
        }
	
        m_adc_evt_counter++;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is nRF Connect Mobile App debug log:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Log-2021_2D00_07_2D00_08-16_5F00_47_5F00_39.txt"&gt;devzone.nordicsemi.com/.../Log-2021_2D00_07_2D00_08-16_5F00_47_5F00_39.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Using the above code, BLE works fine if I only send ADC data (doesn&amp;#39;t include TWI data). Why is that, please? What&amp;#39;s the solution?&lt;/strong&gt; Thank you!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error 8 (0x8): GATT CONN TIMEOUT on nRF52805</title><link>https://devzone.nordicsemi.com/thread/318806?ContentTypeID=1</link><pubDate>Tue, 06 Jul 2021 13:17:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bcef56b-a053-4327-8c0a-6d14224b956e</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I could not see anything obvious from the sniffer log. Could you check that all sdk_config entries are configured to use the RC?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NRFX_CLOCK_CONFIG_LF_SRC&lt;/li&gt;
&lt;li&gt;CLOCK_CONFIG_LF_SRC&lt;/li&gt;
&lt;li&gt;NRF_SDH_CLOCK_LF_SRC&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also, could you try to get an application log? i.e. do you know if here are any errors or asserts in the application once it is disconnected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>