<?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>Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33335/trigger-saadc-sample-task-with-ppi-on-a-ble-rscs-profile</link><description>Hi everyone, 
 Maybe my problem has already been solved in another discussion, if so, I haven&amp;#39;t found it yet ! 
 
 I&amp;#39;m programming on a external board using nrf52832. 
 I&amp;#39;m developping a program based on the ble_app_rscs_ example of the SDK 14.2. 
 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Apr 2018 13:04:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33335/trigger-saadc-sample-task-with-ppi-on-a-ble-rscs-profile" /><item><title>RE: Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/thread/128252?ContentTypeID=1</link><pubDate>Fri, 13 Apr 2018 13:04:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0957c7a6-4e1e-43f4-8827-8b6e8a1f3367</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Glad it worked. It is hard to say&amp;nbsp;why it would suddenly work like that though. I usually modify the weak error handler like this to make it print out the information to a terminal when something asserts:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    static error_info_t  * p_error_info;
    p_error_info = (error_info_t*)info;
    NRF_LOG_ERROR(&amp;quot;Error: ID: %d, PC: 0x%X\n\r&amp;quot;, id, pc);
    NRF_LOG_ERROR(&amp;quot;Error: Code: 0x%04X (%d), Line: %d, File: %s\n\r&amp;quot;, p_error_info-&amp;gt;err_code, p_error_info-&amp;gt;err_code, p_error_info-&amp;gt;line_num, (uint32_t)p_error_info-&amp;gt;p_file_name);
    NRF_LOG_FINAL_FLUSH();
    ...
    ...&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/thread/128117?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 15:37:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c5a24b4-329e-469c-a229-c13abb7aea62</guid><dc:creator>OlivierMun</dc:creator><description>&lt;p&gt;So I tried to debug the program and... it worked !&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just don&amp;#39;t understand what the problem was, so now it works as I wanted to, although I didn&amp;#39;t change anything !&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the support,&lt;/p&gt;
&lt;p&gt;Olivier&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/thread/128108?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 14:56:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d61b667-0725-4f0b-a356-ba8bcf0e13f5</guid><dc:creator>OlivierMun</dc:creator><description>&lt;p&gt;It&amp;#39;s ok, my bad, I have found app_error_handler()&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So the app_error_handler lokks like this :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*lint -save -e14 */
void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
    error_info_t error_info =
    {
        .line_num    = line_num,
        .p_file_name = p_file_name,
        .err_code    = error_code,
    };
    while(1);
    app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&amp;amp;error_info));

    UNUSED_VARIABLE(error_info);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just added the &amp;quot;while(1);&amp;quot; loop in order to follow the post you send me.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So I debug the code and it stopped&amp;nbsp;in the app_error_fault_handler()&amp;nbsp;:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    NRF_LOG_FINAL_FLUSH();

#ifndef DEBUG
    NRF_LOG_ERROR(&amp;quot;Fatal error&amp;quot;);
#else
    switch (id)
    {
#if defined(SOFTDEVICE_PRESENT) &amp;amp;&amp;amp; SOFTDEVICE_PRESENT
        case NRF_FAULT_ID_SD_ASSERT:
            NRF_LOG_ERROR(&amp;quot;SOFTDEVICE: ASSERTION FAILED&amp;quot;);
            break;
        case NRF_FAULT_ID_APP_MEMACC:
            NRF_LOG_ERROR(&amp;quot;SOFTDEVICE: INVALID MEMORY ACCESS&amp;quot;);
            break;
#endif
        case NRF_FAULT_ID_SDK_ASSERT:
        {
            assert_info_t * p_info = (assert_info_t *)info;
            NRF_LOG_ERROR(&amp;quot;ASSERTION FAILED at %s:%u&amp;quot;,
                          p_info-&amp;gt;p_file_name,
                          p_info-&amp;gt;line_num);
            break;
        }
        case NRF_FAULT_ID_SDK_ERROR:
        {
            error_info_t * p_info = (error_info_t *)info;
            NRF_LOG_ERROR(&amp;quot;ERROR %u [%s] at %s:%u&amp;quot;,
                          p_info-&amp;gt;err_code,
                          nrf_strerror_get(p_info-&amp;gt;err_code),
                          p_info-&amp;gt;p_file_name,
                          p_info-&amp;gt;line_num);
            break;
        }
        default:
            NRF_LOG_ERROR(&amp;quot;UNKNOWN FAULT at 0x%08X&amp;quot;, pc);
            break;
    }
#endif

    NRF_BREAKPOINT_COND;
    // On assert, the system can only recover with a reset.

#ifndef DEBUG
    NRF_LOG_WARNING(&amp;quot;System reset&amp;quot;);
    NVIC_SystemReset();
#else
    app_error_save_and_stop(id, pc, info);
#endif // DEBUG
}

/*lint -restore */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;at this line :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_BREAKPOINT_COND;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;my screen looks like this :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1523545010638v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help,&lt;/p&gt;
&lt;p&gt;Olivier&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/thread/128090?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 13:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2a758d0-ba20-42bf-a048-45709e161d85</guid><dc:creator>OlivierMun</dc:creator><description>&lt;p&gt;I&amp;#39;m using Segger, but anyway, I&amp;#39;m following the step by step debug routine explained in the post.&lt;/p&gt;
&lt;p&gt;So went to the definition of APP_ERROR_CHECK() which calls APP_ERROR_HANDLER().&lt;/p&gt;
&lt;p&gt;I went to the definition of APP_ERROR_HANDLER() which calls&amp;nbsp; app_error_handler().&lt;/p&gt;
&lt;p&gt;I wanted to go to the definition of app_error_handler() but it says &amp;quot;Can&amp;#39;t find symbol&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So maybe I did not include the right module ?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve included app_error.c as in the example of nordic.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the definition of APP_ERROR_CHEK()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;ble.h&amp;quot;
#include &amp;quot;ble_err.h&amp;quot;
#include &amp;quot;ble_hci.h&amp;quot;
#include &amp;quot;ble_srv_common.h&amp;quot;
#include &amp;quot;ble_advdata.h&amp;quot;
#include &amp;quot;ble_advertising.h&amp;quot;
#include &amp;quot;ble_bas.h&amp;quot;
#include &amp;quot;ble_rscs.h&amp;quot;
#include &amp;quot;ble_dis.h&amp;quot;
#include &amp;quot;ble_conn_params.h&amp;quot;
#include &amp;quot;sensorsim.h&amp;quot;
#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_soc.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;peer_manager.h&amp;quot;
#include &amp;quot;bsp_btn_ble.h&amp;quot;
#include &amp;quot;fds.h&amp;quot;
#include &amp;quot;ble_conn_state.h&amp;quot;
#include &amp;quot;nrf_ble_gatt.h&amp;quot;

//accelerometer
#include &amp;quot;nrf_drv_twi.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;

//saadc
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;nrf_drv_saadc.h&amp;quot;
#include &amp;quot;nrf_drv_ppi.h&amp;quot;



#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and here are my includes :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Macro for calling error handler function.
 *
 * @param[in] ERR_CODE Error code supplied to the error handler.
 */
#ifdef DEBUG
#define APP_ERROR_HANDLER(ERR_CODE)                                    \
    do                                                                 \
    {                                                                  \
        app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__);  \
    } while (0)
#else
#define APP_ERROR_HANDLER(ERR_CODE)                                    \
    do                                                                 \
    {                                                                  \
        app_error_handler_bare((ERR_CODE));                            \
    } while (0)
#endif
/**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
 *
 * @param[in] ERR_CODE Error code supplied to the error handler.
 */
#define APP_ERROR_CHECK(ERR_CODE)                           \
    do                                                      \
    {                                                       \
        const uint32_t LOCAL_ERR_CODE = (ERR_CODE);         \
        if (LOCAL_ERR_CODE != NRF_SUCCESS)                  \
        {                                                   \
            APP_ERROR_HANDLER(LOCAL_ERR_CODE);              \
        }                                                   \
    } while (0)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your response !&lt;/p&gt;
&lt;p&gt;Olivier&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trigger saadc sample task with ppi on a ble rscs profile</title><link>https://devzone.nordicsemi.com/thread/128087?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 13:39:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e965600c-6eb8-4211-b6df-911da08819c6</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Do you know where your code is stuck? It may have ended up in an endless while loop in an error handler. Have you tried debugging&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;like this&lt;/a&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>