<?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>Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/269/strange-behaviour-with-nrf51822-and-s110</link><description>Hello, I&amp;#39;m trying to develop with the nRF51822 Eval kit and GCC and Eclipse. I&amp;#39;ve been getting some strange behavior and errors lately. I&amp;#39;m not really sure how to describe it better, because I&amp;#39;m not sure what the problem is but I think it&amp;#39;s related to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Aug 2013 09:22:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/269/strange-behaviour-with-nrf51822-and-s110" /><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1462?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2013 09:22:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:555d1622-c7ac-4adf-aa9c-5dac9adf1923</guid><dc:creator>Viktor</dc:creator><description>&lt;p&gt;Now I realized, that it&amp;#39;s probably just the normal behavior when debugging with softdevice running, so everything looks to be alright now. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1461?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2013 12:38:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ef9da5-4f9c-461f-83e4-c9354215281f</guid><dc:creator>Viktor</dc:creator><description>&lt;p&gt;Unfortunately it looks like there are still some problems :(
Basically, right now I have a program that get&amp;#39;s stuck if I try to step through it but runs fine when I just hit run. I&amp;#39;ll try to document it more and post some details tomorrow, maybe try running GDB from command line and see if that helps as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1460?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2013 06:40:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2f0cf9e-9e1c-430b-a9e0-67a40438aab7</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Sounds good! If you found this answer helpful, I&amp;#39;d be happy if you could click the &amp;quot;Accept as answer&amp;quot; button, to mark this question as resolved. :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1459?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2013 05:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec5396bf-8d22-4f3b-ae36-89cf80a30123</guid><dc:creator>Viktor</dc:creator><description>&lt;p&gt;The last comment was mine, just forgot to log in :S&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1463?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2013 05:15:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:719ef4da-a364-4916-8c1d-ece10fa03f90</guid><dc:creator>Guest</dc:creator><description>&lt;p&gt;Thanks!
Seems to work so far but I&amp;#39;m going to test it a little bit more to make sure no more unexpected errors pop up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1458?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2013 05:15:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:785e55e9-2ca7-44a1-a188-8e66fff300a2</guid><dc:creator>Bastiaan</dc:creator><description>&lt;p&gt;Thanks!
Seems to work so far but I&amp;#39;m going to test it a little bit more to make sure no more unexpected errors pop up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1457?ContentTypeID=1</link><pubDate>Fri, 16 Aug 2013 10:57:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f57818cc-7b80-45bf-bfd2-3de571969c5f</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I&amp;#39;ve seen this error sometimes, but I&amp;#39;ve had troubles with reproducing it consistently. However, my current theory is that this has something to do with how Eclipse launches GDB. I&amp;#39;ve never seen it when running GDB manually from the command line.&lt;/p&gt;
&lt;p&gt;It seems to possibly be caused by Ecliipse not doing a reset of the chip after loading the new firmware, and hence causing confusion. I have unfortunately not found an easy way to make it do so, but as far as I&amp;#39;ve seen, changing the startup commands to just this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
file &amp;quot;c:\full\path\to\your\file.out&amp;quot; 
load
mon reset 

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and removing the checkboxes for loading symbol table and binary file, seems to make it work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1456?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2013 13:29:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:083b7ce2-f4ba-40ba-84dd-75d90c2e6a20</guid><dc:creator>Viktor</dc:creator><description>&lt;p&gt;Hello,
I have tested everything a bit more and it seems that I get different program behavior when I&amp;#39;m using the debugger and when the device is running on it&amp;#39;s own. Also, I am getting one kind of errors when running a debug session right after starting the GDB server and a different errors in subsequent runs. Sometimes, I have to re-flash the softdevice because nRFGo studio can&amp;#39;t detect it and the J-Link GDB server can&amp;#39;t connect to the board. I guess it get&amp;#39;s corrupted in the memory somehow.
All of this leads me to believe that the debugger is not functioning properly and is the cause of all this trouble. I have &lt;a href="https://devzone.nordicsemi.com/index.php/problem-running-debugging-nrf51822-gcc-example-project"&gt;made a post earlier&lt;/a&gt; about having some trouble getting the debugger to work and I thought it was solved but it seems that there are still some problems.
I would be grateful if you could give me some pointers about how to set it up properly, because developing without a debugger is far from ideal.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m attaching a simple program for PCA10000 that demonstrates the weird behavior -
When I run it on it&amp;#39;s own it lights up the blue LED. During the first debug session after starting the GDB server it lights up blue too but during the subsequent sessions it lights up red.
With more complex programs I get incorrect behavior even during the first debug session - for example advertising seems not to be working.&lt;/p&gt;
&lt;pre&gt;&lt;code&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;nrf51_bitfields.h&amp;quot;
#include &amp;quot;ble_stack_handler.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;


#define DEAD_BEEF   0xDEADBEEF
#define LED_RED		21
#define LED_GREEN	22
#define LED_BLUE	23

void leds_init( void )
{
	nrf_gpio_cfg_output(LED_RED);
    nrf_gpio_cfg_output(LED_GREEN);
	nrf_gpio_cfg_output(LED_BLUE);

	nrf_gpio_pin_set(LED_RED);
	nrf_gpio_pin_set(LED_GREEN);
	nrf_gpio_pin_set(LED_BLUE);
}

void leds_set(uint8_t msk)
{
	if(msk &amp;amp; 0x1)
		nrf_gpio_pin_clear(LED_RED);
	else
		nrf_gpio_pin_set(LED_RED);

	if(msk &amp;amp; 0x2)
		nrf_gpio_pin_clear(LED_GREEN);
	else
		nrf_gpio_pin_set(LED_GREEN);

	if(msk &amp;amp; 0x4)
		nrf_gpio_pin_clear(LED_BLUE);
	else
		nrf_gpio_pin_set(LED_BLUE);

}

void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
	// Light up red LED
	leds_set(0x01);
	while(1);
}


void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
{
    app_error_handler(DEAD_BEEF, line_num, p_file_name);
}



static void ble_stack_init(void)
{
    BLE_STACK_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM,
                           BLE_L2CAP_MTU_DEF,
                           NULL,
                           false);
}

int main(void)
{
    leds_init();

    ble_stack_init();

    // Light up red LED
    leds_set(0x04);

    while(1);
}

&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange behaviour with nRF51822 and S110</title><link>https://devzone.nordicsemi.com/thread/1455?ContentTypeID=1</link><pubDate>Tue, 13 Aug 2013 12:19:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfc5001f-80e4-4936-869d-e01e7121231b</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Viktor,&lt;/p&gt;
&lt;p&gt;That error (specified in nrf_error_soc.h) translates to:
NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED&lt;/p&gt;
&lt;p&gt;The softdevice does not allow interrupt priority set to &amp;#39;0&amp;#39; or &amp;#39;2&amp;#39;, only &amp;#39;1&amp;#39; and &amp;#39;3&amp;#39;.
Try setting all your interrupts to either &amp;#39;1&amp;#39; or &amp;#39;3&amp;#39; before enabling the BLE-stack, using this function:
NVIC_SetPriority(my_IRQ, x);&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>