<?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>Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11857/working-sample-programs-crashing-on-custom-board</link><description>Hi,
I have made my custom board using nrf51422 sample chips (Which came nrf 51422DK ), but my working / sample program which works on DK gets crashed on custom Board. 
 Blinking works fine, but uart and other soft device programs crashes. 
 Marking</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Feb 2016 13:07:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11857/working-sample-programs-crashing-on-custom-board" /><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44926?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 13:07:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20dda25b-54a8-4ced-8199-fa869884aaa8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;When there is a &lt;code&gt;APP_UART_COMMUNICATION_ERROR&lt;/code&gt;, the &lt;code&gt;error_communication&lt;/code&gt; field contain the value of the ERRORSRC register. Bit 2 and 3 are set, which indicate that a framing error occurred (bit 2) and a break condition (bit 3). I don&amp;#39;t understand what causes it, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44925?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 12:20:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a593bdb-9296-4eef-9ed2-baa8a71691ae</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;This is what i get when i try to print app_uart_Evt.data.error_communication (12)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#1  0x0000030e in uart_error_handle (p_event=0x20007f70) at /home/qwe/Downloads/ClubTag/nRF_SDK_9.0/examples/peripheral/uart/main.c:42
(gdb) p p_event-&amp;gt;
data      evt_type
(gdb) p p_event-&amp;gt;
data      evt_type
(gdb) p p_event-&amp;gt;data.
error_code           error_communication  value
(gdb) p p_event-&amp;gt;data.error_communication 
$1 = 12
(gdb) up
#2  0x00000aea in UART0_IRQHandler () at /home/qwe/Downloads/ClubTag/nRF_SDK_9.0/components/drivers_nrf/uart/app_uart_fifo.c:327
(gdb) up
#3  &amp;lt;signal handler called&amp;gt;
(gdb)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44924?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 11:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:065184bb-564a-432d-94df-253c04f1c34c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The UART module normally use the internal oscillator, not the external crystal, so you should not need to do anything. You can see this from the Block resource requirements section in the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.pdf.ps/nRF51822_PS_v3.1.pdf"&gt;Product specification&lt;/a&gt;. Just in case there is a clock issue, can you try to set constant latency mode in order to force the clock always on? Put this line in the beginning of your main function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_POWER-&amp;gt;TASKS_CONSTLAT = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From your debugging, it seems that an error is found in the call to &lt;code&gt;APP_ERROR_HANDLER()&lt;/code&gt; on line 42 in your main.c. This is due to a &lt;code&gt;APP_UART_COMMUNICATION_ERROR&lt;/code&gt;, which indicate that a communication error has occurred during reception. The error is stored in app_uart_evt_t.data.error_communication field. Can you check that field in the debugger?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44923?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 10:28:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:376666c7-cd1a-4b08-ae8e-9591bbab25d2</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;Hi I forgot to mention we are not using any external crystals. As external crystal is required for Radio (16MHZ). Any way we are not using any radio functionality or softdevices.
Do i need to make any changes in the code to run the code on internal Oscillator&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44916?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 10:26:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7260be1c-9274-40b6-a53f-839af2457bab</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I have not been able to reproduce this. What is the other differences between your board and the DK? I assume you have the correct pin numbers for RX, TX, RTS and CTS (in case they are different on your board and DK)? Could you you try to disable flow control?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44922?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 09:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4389c706-0c41-4e8d-9500-907c66b8cc15</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;The program runs fine on NRF DK 51, but not on our chip&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
 *
 * The information contained herein is property of Nordic Semiconductor ASA.
 * Terms and conditions of usage are described in detail in NORDIC
 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
 *
 * Licensees are granted free, non-transferable use of the information. NO
 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
 * the file.
 *
 */

/** @file
 * @defgroup uart_example_main main.c
 * @{
 * @ingroup uart_example
 * @brief UART Example Application main file.
 *
 * This file contains the source code for a sample application using UART.
 * 
 */

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;app_uart.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;

//#define ENABLE_LOOPBACK_TEST  /**&amp;lt; if defined, then this example will be a loopback test, which means that TX should be connected to RX to get data loopback. */

#define MAX_TEST_DATA_BYTES     (15U)                /**&amp;lt; max number of test bytes to be used for tx and rx. */
#define UART_TX_BUF_SIZE 256                         /**&amp;lt; UART TX buffer size. */
#define UART_RX_BUF_SIZE 256                           /**&amp;lt; UART RX buffer size. */

void uart_error_handle(app_uart_evt_t * p_event)
{
    if (p_event-&amp;gt;evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
    }
    else if (p_event-&amp;gt;evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_code);
    }
}



#ifdef ENABLE_LOOPBACK_TEST
/** @brief Function for setting the @ref ERROR_PIN high, and then enter an infinite loop.
 */
static void show_error(void)
{
    
    LEDS_ON(LEDS_MASK);
    while(true)
    {
        // Do nothing.
    }
}


/** @brief Function for testing UART loop back. 
 *  @details Transmitts one character at a time to check if the data received from the loopback is same as the transmitted data.
 *  @note  @ref TX_PIN_NUMBER must be connected to @ref RX_PIN_NUMBER)
 */
static void uart_loopback_test()
{
    uint8_t * tx_data = (uint8_t *)(&amp;quot;\n\rLOOPBACK_TEST\n\r&amp;quot;);
    uint8_t   rx_data;

    // Start sending one byte and see if you get the same
    for (uint32_t i = 0; i &amp;lt; MAX_TEST_DATA_BYTES; i++)
    {
        uint32_t err_code;
        while(app_uart_put(tx_data[i]) != NRF_SUCCESS);

        nrf_delay_ms(10);
        err_code = app_uart_get(&amp;amp;rx_data);

        if ((rx_data != tx_data[i]) || (err_code != NRF_SUCCESS))
        {
            show_error();
        }
    }
    return;
}


#endif


/**
 * @brief Function for main application entry.
 */
int main(void)
{
    LEDS_CONFIGURE(LEDS_MASK);
    LEDS_OFF(LEDS_MASK);
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          APP_UART_FLOW_CONTROL_ENABLED,
          false,
          UART_BAUDRATE_BAUDRATE_Baud38400
      };

    APP_UART_FIFO_INIT(&amp;amp;comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOW,
                         err_code);

    APP_ERROR_CHECK(err_code);

#ifndef ENABLE_LOOPBACK_TEST
    printf(&amp;quot;\n\rStart: \n\r&amp;quot;);

    while (true)
    {
        uint8_t cr;
        while(app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
        while(app_uart_put(cr) != NRF_SUCCESS);

        if (cr == &amp;#39;q&amp;#39; || cr == &amp;#39;Q&amp;#39;)
        {
            printf(&amp;quot; \n\rExit!\n\r&amp;quot;);

            while (true)
            {
                // Do nothing.
            }
        }
    }
#else

    // This part of the example is just for testing the loopback .
    while (true)
    {
        uart_loopback_test();
    }
#endif
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44920?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 08:14:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6683531f-d7bb-4224-9db6-070dd978f62f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Error code 12 is &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s110.api.v8.0.0/group__nrf__error.html#ga4c61f2b54667506e90cc296721b2e658"&gt;&lt;code&gt;NRF_ERROR_DATA_SIZE&lt;/code&gt;&lt;/a&gt;, which normally indicate that the data size exceeds limit. You could try to increase the buffer sizes (defined near the top of main.c), but there should not be any difference from the DK to your board.&lt;/p&gt;
&lt;p&gt;Have you made any changes from the example? If so which? Can you upload your modified example here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44921?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2016 06:32:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e10a71e-01e9-4155-9004-573e38ba7727</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;We use gcc and gdb for debugging. This is the  error we get 0x00001bac when we reach printf statement and the program crashes. We are running the uart example code with out softdevice. UART Peripheral example.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#0  0x000004de in app_error_handler (error_code=12, line_num=42, 
   p_file_name=0x2ac8 &amp;quot;/home/akhil/work/code/nRF51_SDK_9/examples/peripheral/uart/main.c&amp;quot;)
   at /home/akhil/work/code/nRF51_SDK_9/components/libraries/util/app_error.c:84
#1  0x0000035c in uart_error_handle (p_event=0x20007f70)
   at /home/akhil/work/code/nRF51_SDK_9/examples/peripheral/uart/main.c:42
#2  0x00000b3e in UART0_IRQHandler ()
   at /home/akhil/work/code/nRF51_SDK_9/components/drivers_nrf/uart/app_uart_fifo.c:327
#3  &amp;lt;signal handler called&amp;gt;
#4  0x00001bf0 in printf ()
#5  0x00000430 in main ()
   at /home/akhil/work/code/nRF51_SDK_9/examples/peripheral/uart/main.c:125
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44919?ContentTypeID=1</link><pubDate>Mon, 15 Feb 2016 12:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b4ff671-4bce-4dd4-b7d7-934b5c6975ae</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It seems you are using the same chip variant as the DK, which also has a QFAC. As long as you initialize the SoftDevice with the correct settings for 32 kHz clock, I do not see what should be different. Which version of the SDK and SoftDevice do you use? Can you disable optimization and define &lt;code&gt;DEBUG&lt;/code&gt; and use a debugger to figure out exactly where the error occurs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44918?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 14:17:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a20ebf6a-4f71-4180-a60e-87726a10bffc</guid><dc:creator>Faizan</dc:creator><description>&lt;p&gt;We are not using external 32khz crystal oscillator, Followed DC-DC schematic from the nrf Specs. We have configured the stack to use internal RC with 250 ppm 4 msec calibration clock.&lt;/p&gt;
&lt;p&gt;Even the UART sample program crashes at printf() statement. But I&amp;#39;m able to run blinky example perfectly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Working / sample programs crashing on Custom Board?</title><link>https://devzone.nordicsemi.com/thread/44917?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 13:45:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:534ad289-3a06-421c-b114-18caa2a5568e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I think you need to provide more info in order to make it possible for anyone to try to understand the issue.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What is the difference between your hardware and the DK? Are you using a 32 kHz crystal? (the clock source is specified when the SoftDevice is initialized).&lt;/li&gt;
&lt;li&gt;How does the software fail and in what situations? Have you used a debugger to investigate the details?&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>