<?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>piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28591/piezo-buzzer-has-to-generate-sound-until-event-occurs</link><description>i successfully generated sound using pwm and piezo buzzer 
 while(/*while event occurs*/)
{
	for (uint8_t i = 0; i &amp;lt; 50; ++i)
	{
 value = (i &amp;lt; 20) ? (i * 5) : (100 - (i - 20) * 5);
 /* Set the duty cycle - keep trying until PWM is ready... */
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Jan 2018 05:51:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28591/piezo-buzzer-has-to-generate-sound-until-event-occurs" /><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113309?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2018 05:51:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e211c6f2-67b6-41f0-ad49-5685cf880a81</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;i am trying to dinit and the init of pwm after changing frequency, is this correct method.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113307?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2018 13:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:601a548b-5a7b-4318-81ab-a9b5ec512c39</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;Ok, frequency would be controlled by how often your timer event fires.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113308?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2017 05:13:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a35501a7-fe6e-4f8e-a6e0-4bad483150aa</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;Sorry i was talking about frequency&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113306?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 14:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:502eb710-6b45-40b8-b044-77c8d5c7f92c</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;I am not following you; duty cycle is typically a variable in PWM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113305?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 13:29:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f9a8e48-8836-49d9-a2ca-562787a85a16</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;i could successfully change duty cycle , i got struck in pwm&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113304?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 14:36:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ebd1c93-1335-4845-8bc5-d7a48848619d</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;Any luck with this design change?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113303?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 14:42:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb377e10-e5de-4b76-b317-341251e37198</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;It is possible to have more than one timer, but I wouldn&amp;#39;t recommend setting up and tearing down a timer within another timer.&lt;/p&gt;
&lt;p&gt;You should be able to just change your interval and increment the PWM setting on each call of the timer event.&lt;/p&gt;
&lt;p&gt;Finally, you could stop the timer when the max value is configured, and set it back to the starting one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113302?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 14:36:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a31d84cc-0bb0-4b0b-a512-4ca8e18f7ad5</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;can i use two timers ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113301?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 14:22:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bc26692-74ea-4fb7-88fa-91458ec5d5c5</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;I expect this is due to both the timer having too high of a priority and the for loop being a rather long callback in the timer. This might be causing a timeout in the BLE stack.&lt;/p&gt;
&lt;p&gt;First check the priority of your timed event, and try setting it to 5 or lower.
Second, try removing the for loop from your code too, and instead increment the value in each timer event.&lt;/p&gt;
&lt;p&gt;P.s. this might be justified as a second question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113300?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 12:17:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d110233-7afa-46af-a7ce-bfe72447aa2a</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;I am trying to replace while loop with timer, i have used simple timer example as reference. due to some reason connection is getting disconnected. What shall i do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113299?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 12:16:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a29b9c45-b18d-44fb-9381-359f54a86fa6</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;Yeah, depending on your use case you can start and stop it where needed.
The timer then replaces the while loop where the deadlock is hit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113298?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 10:57:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b02a7be5-9ad7-43bf-a251-fe5355b6ae17</guid><dc:creator>DMS</dc:creator><description>&lt;p&gt;event is triggered from application, u mean to say :- start timer when event is triggered from mobile application and stop timer when request to stop from mobile app. ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: piezo buzzer has to generate sound until event occurs</title><link>https://devzone.nordicsemi.com/thread/113297?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 10:07:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c774ed35-74b0-428d-a4c3-e26fccb1bb72</guid><dc:creator>Kyle Krueger</dc:creator><description>&lt;p&gt;It looks like your event has a lower priority than the while loop.&lt;/p&gt;
&lt;p&gt;If this is the case, you have an architecture problem. You could use the quick and dirty fix of moving this loop to a lower priority, but I would recommend some extra changes.&lt;/p&gt;
&lt;p&gt;My suggestion would be to set up the buzzer on a timed event with low priority. You can turn on this timed event where you see fit, and turn it off in the event you are waiting for.&lt;/p&gt;
&lt;p&gt;Again, the priority of your event should be higher than that of your timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>