<?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>How to remotely &amp;quot;check&amp;quot; NRF-51 BLE connectivity?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65150/how-to-remotely-check-nrf-51-ble-connectivity</link><description>&amp;gt;I will start by prefacing that I&amp;#39;m not by any means an engineer and my only knowledge with BLE/embedded systems comes from curiosity, side projects and trial/error&amp;lt; 
 
 Story: 
 I live in a small condominium where we have 1 big metal gate to get in/out</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Aug 2020 17:44:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65150/how-to-remotely-check-nrf-51-ble-connectivity" /><item><title>RE: How to remotely "check" NRF-51 BLE connectivity?</title><link>https://devzone.nordicsemi.com/thread/266585?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 17:44:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2925463b-3797-49fb-9de3-790a102b073a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="89812" url="~/f/nordic-q-a/65150/how-to-remotely-check-nrf-51-ble-connectivity/266571"]&lt;p&gt;&lt;span&gt;&amp;gt;&amp;nbsp;Is the&amp;nbsp;firmware&amp;nbsp;running on the device compiled with &amp;quot;DEBUG&amp;quot;&amp;nbsp;preprocessor symbol defined?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Yes, it is.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;This is likely the reason the device becomes&amp;nbsp;&lt;span&gt;unresponsive then.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Some function has returned an error-code, or you get an assert somewhere in the code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The&amp;nbsp;app_error_fault_handler() will be called. If DEBUG is not defined, the system will reset.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    NRF_LOG_ERROR(&amp;quot;Fatal\r\n&amp;quot;);
    NRF_LOG_FINAL_FLUSH();
    // On assert, the system can only recover with a reset.
#ifndef DEBUG
    NVIC_SystemReset();
#else
    app_error_save_and_stop(id, pc, info);
#endif // DEBUG&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If DEBUG is defined, you will then enter&amp;nbsp;app_error_save_and_stop()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info)
{
    /* static error variables - in order to prevent removal by optimizers */
    static volatile struct
    {
        uint32_t        fault_id;
        uint32_t        pc;
        uint32_t        error_info;
        assert_info_t * p_assert_info;
        error_info_t  * p_error_info;
        ret_code_t      err_code;
        uint32_t        line_num;
        const uint8_t * p_file_name;
    } m_error_data = {0};

    // The following variable helps Keil keep the call stack visible, in addition, it can be set to
    // 0 in the debugger to continue executing code after the error check.
    volatile bool loop = true;
    UNUSED_VARIABLE(loop);

    m_error_data.fault_id   = id;
    m_error_data.pc         = pc;
    m_error_data.error_info = info;

    switch (id)
    {
        case NRF_FAULT_ID_SDK_ASSERT:
            m_error_data.p_assert_info = (assert_info_t *)info;
            m_error_data.line_num      = m_error_data.p_assert_info-&amp;gt;line_num;
            m_error_data.p_file_name   = m_error_data.p_assert_info-&amp;gt;p_file_name;
            break;

        case NRF_FAULT_ID_SDK_ERROR:
            m_error_data.p_error_info = (error_info_t *)info;
            m_error_data.err_code     = m_error_data.p_error_info-&amp;gt;err_code;
            m_error_data.line_num     = m_error_data.p_error_info-&amp;gt;line_num;
            m_error_data.p_file_name  = m_error_data.p_error_info-&amp;gt;p_file_name;
            break;
    }

    UNUSED_VARIABLE(m_error_data);

    // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger.
    __disable_irq();
    while (loop);

    __enable_irq();
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and you will be stuck in the while-loop.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to remotely "check" NRF-51 BLE connectivity?</title><link>https://devzone.nordicsemi.com/thread/266571?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 16:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab643611-dbb6-493d-8782-7451f3b38bd3</guid><dc:creator>gabi46</dc:creator><description>&lt;p&gt;&lt;span&gt;&amp;gt; What do you mean by &amp;quot;debug mode&amp;quot;? Do you mean that the nRF-51 just becomes&amp;nbsp;unresponsive?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Yes, the NRF stops working (gets unresponsive), and to fix it I need to go to the garage and turn on/off manually. When I do it I can reach it again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;gt;&amp;nbsp;Is the&amp;nbsp;firmware&amp;nbsp;running on the device compiled with &amp;quot;DEBUG&amp;quot;&amp;nbsp;preprocessor symbol defined?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Yes, it is.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;gt;&amp;nbsp;That said, I don&amp;rsquo;t know why you would want to do that, what are you trying to achieve by that?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My main goal here was to create a gate opener using only cellular connection and Bluetooth to which I could have remote control of both (so I wouldn&amp;#39;t need to physically reboot or update any device). The gate would be mainly triggered by BLE connection (open/close) via the NRF-51 and if someone couldn&amp;#39;t open the gate for any reason, I could rely on the Boron/Electron for cellular connection and trigger the gate online and remotely.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your answer!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to remotely "check" NRF-51 BLE connectivity?</title><link>https://devzone.nordicsemi.com/thread/266558?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 14:55:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f8e5da4-9126-40d6-a69d-613af54d925e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]the NRF-51 is getting on debug mode randomly[/quote]
&lt;p&gt;What do you mean by &amp;quot;debug mode&amp;quot; ? You mean that the nRF-51 just becomes&amp;nbsp;unresponsive ? Is the&amp;nbsp;firmware&amp;nbsp;running on the device compiled with &amp;quot;DEBUG&amp;quot;&amp;nbsp;preprocessor symbol defined ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]&lt;p&gt;&lt;/p&gt;&lt;p style="color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;- There&amp;#39;s a way to track the NRF-51 DK BLE connectivity remotely? If yes, is it possible via the particle cloud (I don&amp;#39;t know, maybe via a device with BLE too like the Boron being use as a peripheral?)?&lt;/p&gt;&lt;p style="color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;- If this is not possible, how could I make sure remotely that the NRF51 is &amp;quot;alive&amp;quot; and responding?&lt;/p&gt;&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Yes, something like the Boron could possibly be used for this, since if the nRF51-DK loses BLE connection to the Electron, it will likely lose connection to the Boron as well. That said, I don’t know why you would want to do that, what are you trying to achieve by that? If you e.g. want to know how often the device is reset by the WDT, then it&amp;#39;s possible to e.g. increment and save some value to flash/RAM at every reboot, and then advertise this value. Overall, the Watchdog timer is a good solution to keep the device, as you say, &amp;quot;alive&amp;quot; and responding, but if you want to eliminate this issue, then you would likely need to try to recreate the issue while debugging in you preferred IDE, and check if there is some functions that returns any error-codes, if code gets stuck somewhere, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>