<?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>Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7634/periodically-switching-into-config-mode-on-nrf51822-beacon-kit</link><description>Hi, 
 I have implemented some code to periodically switching back and forth between the normal and the config mode. I can see that the handler function is being called, but the beacon does not switch into the config mode. The following is what I implemented</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Jun 2015 20:29:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7634/periodically-switching-into-config-mode-on-nrf51822-beacon-kit" /><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27228?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 20:29:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f65f2306-603f-4046-a610-2a8c9e93672d</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;I thought I had fixed that, but apparently not. Thanks so much for your Help Hung! It works now :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27230?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 14:33:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e3edb25-7522-471e-922d-b07776e5d3d0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Sarah,&lt;/p&gt;
&lt;p&gt;Please make sure you have increased the APP_TIMER_MAX_TIMERS define to match with the number of timer you used.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27229?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 02:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96607015-56be-45ff-b349-ea00a519b4f9</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;When I update the beacon_setup function like you mentioned, I discovered that the config_mode_timeout_handler function is never even called. I debugged the code and saw that
app_timer_create function  returns with  NRF_ERROR_NO_MEM for some reason (hence I believe timer is never called and timer handler is never run). How can I fix this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27227?ContentTypeID=1</link><pubDate>Wed, 17 Jun 2015 12:28:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8209f99-d13a-4013-88f1-9d4375e798dd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Sarah: I don&amp;#39;t see any reason it shouldn&amp;#39;t work. The main difference between the 2 mode is the advertising type. When in normal mode it advertise with non connectable BLE_GAP_ADV_TYPE_ADV_NONCONN_IND type, when in configure more it&amp;#39;s BLE_GAP_ADV_TYPE_ADV_IND type.&lt;/p&gt;
&lt;p&gt;I think you should check and make sure you have NRF_SUCCESS return when calling each of the functions when switching. To do that you can add a break point in the error assert handler, and look for the err_code, line and file name that cause the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27226?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2015 15:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2647e992-43a0-4caf-bb29-00729c1ab67a</guid><dc:creator>Sarah</dc:creator><description>&lt;p&gt;Thanks very much Hung. Just to clarify what I&amp;#39;m trying to do, I want the beacon to act exactly like the sw2 button is pressed. The beacon becomes connectable and the led light changes to indicate this. So  I use the following as my new beacon_setup function now, and I still do not see any change. Why could that be?&lt;/p&gt;
&lt;p&gt;static void beacon_setup(beacon_mode_t mode)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//if(mode == beacon_mode_config)
//{
    gap_params_init();
    services_init();
   // advertising_init(beacon_mode_config);
    conn_params_init();
    sec_params_init();
    led_softblink_off_time_set(2000);
    led_softblink_start(APP_CONFIG_MODE_LED_MSK);
//}
//else
//{
    advertising_init(beacon_mode_normal);
    
    if (p_beacon-&amp;gt;data.led_state)
    {
        led_softblink_start(APP_BEACON_MODE_LED_MSK);
    }
//}    
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;//My handler for switching between modes&lt;/p&gt;
&lt;p&gt;static void config_mode_timeout_handler(void * p_context)
{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	if(m_beacon_mode == beacon_mode_normal)
	{
		m_beacon_mode = beacon_mode_config;
	}
	else
	{
		m_beacon_mode = beacon_mode_normal;
	}
	
	advertising_stop();
	advertising_init(m_beacon_mode);
	advertising_start();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}
Also, do you think it would work if I just called beacon_start function with both beacon_mode_config and then with beacon_mode_normal? (This doesn&amp;#39;t seem to work. Beacon stops advertising after it starts up, I&amp;#39;m not sure why)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Periodically switching into config mode on nRF51822 Beacon Kit</title><link>https://devzone.nordicsemi.com/thread/27225?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2015 09:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8140b19-b16a-4018-84f0-a32cb19f80a0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Sarah:&lt;/p&gt;
&lt;p&gt;If you have a look at our code in beacon_setup() in main.c you can find that we need to init some parameter such as gap, services, connection parameter, security when we are in config mode.&lt;/p&gt;
&lt;p&gt;For your application, since you are switching back and forth a lot, I would suggest you to do this configuration at the begining regardless which mode you will be running. Good thing is that you can have this configuration when you running in both modes.&lt;/p&gt;
&lt;p&gt;The main difference that effectively tells apart which mode is currently running is when calling advertising_init(). If you have called the configuration init as mentioned above, you should be fine. Note that you should better call sd_ble_gap_adv_stop() and sd_ble_gap_adv_start() again after you have changed the advertising flags and data in the advertising_init() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>