<?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 implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16131/how-to-implement-buzzer-in-ble_uart_peripheral-example</link><description>Hi, 
 I am using nrf52 with sdk11.0, I have migrated the code of pwm_library code to ble_uart_peripheral.
But when i&amp;#39;m initializing the pwm the code it stops the advertising.Is there an
code which works Ble and buzzer at the same time.
Please help</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Sep 2016 12:36:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16131/how-to-implement-buzzer-in-ble_uart_peripheral-example" /><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61529?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2016 12:36:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b56b7f81-2384-46ff-bab6-c8d7cc7a9708</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Did you have any progress on this issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61531?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 08:43:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0818c3b8-f64b-48af-aab8-e82bd90b7e8b</guid><dc:creator>singh</dc:creator><description>&lt;p&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void power_manage(void)
{
    uint32_t err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);
}

/***********PWM callback function*********/
void pwm_ready_callback(uint32_t pwm_id)    
{
    ready_flag = true;
}
/* 2channel PWM, 5kHz, output on DK LED pins. */
 app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(200L, TEST_PIN,BSP_LED_1); 
static void on_timeout(void * p_context)
{
    uint32_t err_code;
    uint32_t value;
         app_pwm_enable(&amp;amp;PWM1);
   // APP_ERROR_CHECK(err_code);
    for (uint8_t i = 0; i &amp;lt; 60; ++i)
    {
         value = (i &amp;lt; 30) ? (i * 5) : (100 - (i - 30) * 5); 
         ready_flag = false;
         while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, value) == NRF_ERROR_BUSY);
        //while(!ready_flag);
        APP_ERROR_CHECK(app_pwm_channel_duty_set(&amp;amp;PWM1, 1, value));
    }  

}
void timer_init()
{
        uint32_t err_code;
        APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    err_code = app_timer_create(&amp;amp;m_led_a_timer_id,APP_TIMER_MODE_REPEATED,on_timeout);
      err_code = app_timer_start(m_led_a_timer_id, APP_TIMER_TICKS(2000, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

}

/**@brief Application main function.
 */
int main(void)
{
    uint32_t err_code;
    bool erase_bonds;
    timer_init();           
      uart_init(); // baudrate 115200
    buttons_leds_init(&amp;amp;erase_bonds);
    pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
      app_pwm_init(&amp;amp;PWM1,&amp;amp;pwm1_cfg,pwm_ready_callback);
      ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();
    printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);


    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61528?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 05:33:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:751b354e-5717-4012-9bc8-638b596e2bd8</guid><dc:creator>singh</dc:creator><description>&lt;p&gt;Please let me know what should i do to resolve this problem
regards prudhvi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61527?ContentTypeID=1</link><pubDate>Fri, 02 Sep 2016 06:15:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36b326db-4deb-41b1-9ed1-d283fd7c4107</guid><dc:creator>singh</dc:creator><description>&lt;p&gt;Code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void power_manage(void)
{
    uint32_t err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);
}

/***********PWM callback function*********/
void pwm_ready_callback(uint32_t pwm_id)    
{
    ready_flag = true;
}
/* 2channel PWM, 5kHz, output on DK LED pins. */
 app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(200L, TEST_PIN,BSP_LED_1); 
static void on_timeout(void * p_context)
{
	uint32_t err_code;
	uint32_t value;
		 app_pwm_enable(&amp;amp;PWM1);
   // APP_ERROR_CHECK(err_code);
	for (uint8_t i = 0; i &amp;lt; 60; ++i)
	{
		 value = (i &amp;lt; 30) ? (i * 5) : (100 - (i - 30) * 5); 
		 ready_flag = false;
		 while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, value) == NRF_ERROR_BUSY);
		//while(!ready_flag);
		APP_ERROR_CHECK(app_pwm_channel_duty_set(&amp;amp;PWM1, 1, value));
	}  
  
}
void timer_init()
{
		uint32_t err_code;
		APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    err_code = app_timer_create(&amp;amp;m_led_a_timer_id,APP_TIMER_MODE_REPEATED,on_timeout);
	  err_code = app_timer_start(m_led_a_timer_id, APP_TIMER_TICKS(2000, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
	
}

/**@brief Application main function.
 */
int main(void)
{
    uint32_t err_code;
    bool erase_bonds;
  	timer_init();			
	  uart_init(); // baudrate 115200
    buttons_leds_init(&amp;amp;erase_bonds);
   	pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
	  app_pwm_init(&amp;amp;PWM1,&amp;amp;pwm1_cfg,pwm_ready_callback);
	  ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();
    printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
	  
    
    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61530?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 19:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d490f398-61e2-4a57-be13-11859b49d625</guid><dc:creator>flip-flop</dc:creator><description>&lt;p&gt;Hi, please post initialization part of code. I had the same problem so maybe I can help you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to implement buzzer in ble_uart_peripheral example</title><link>https://devzone.nordicsemi.com/thread/61526?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2016 12:30:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eb42772-f95d-4905-910b-510661173bb8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I do not see any reason why using the PWM library should cause advertising to stop (it should be independent of each other). My guess is that some form error has occurred. Have you tried using a debugger to see if for example an &lt;a href="https://devzone.nordicsemi.com/blogs/821"&gt;error check&lt;/a&gt; has failed? In that case you could probably pinpoint the location of the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>