<?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>unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13286/unexpected-system-reset-when-triggerring-pwm-with-ble-connected</link><description>Hi Experts， 
 I use TIMER_1 and PPI to driver a &amp;#39;H&amp;#39; style bridge for our motor. Unexpected system reset will happen if I trigger the &amp;#39;H&amp;#39; bridge PWM with ble connected. It works fine if ble is not connected. Seems there is something conflicted between</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Apr 2016 13:27:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13286/unexpected-system-reset-when-triggerring-pwm-with-ble-connected" /><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50651?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2016 13:27:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4b35a4d-b496-4706-89c7-bc2a7bde8592</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Zhao&lt;/p&gt;
&lt;p&gt;There is a 4xPWM example with softdevice available on &lt;a href="https://devzone.nordicsemi.com/question/62942/buzzer-beep-in-immediate-alert-service/"&gt;this thread&lt;/a&gt;. Please check if that works for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50648?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2016 11:51:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a9be94f-3da8-484c-a2de-eda515318abe</guid><dc:creator>zhao</dc:creator><description>&lt;p&gt;I tried to do like this: create two pwm to control pair( RU, LD) and pair( LU, RD) independently. I also create a app_timer to switch the two pwm. Firstly I enable PWM1 to enable pair(LU, RD), and start the app_timer. when the app_timer reach the timeout_ticks, I disable PWM1 and enable PWM2. The app_timer is created as repeated to alternatively enable PWM1 and PWM2.
But, it does not work. below is my code, is there anything wrong? :
[PS: How to paste the code to be easy review :( ]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_PWM_INSTANCE(PWM1,1);                   // Create the instance &amp;quot;PWM1&amp;quot; using TIMER1.
APP_PWM_INSTANCE(PWM2,2);                   // Create the instance &amp;quot;PWM1&amp;quot; using TIMER1.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;static app_timer_t      m_motor_timer;
static app_timer_id_t		m_motor_timer_id = &amp;amp;m_motor_timer;  /**&amp;lt; Polling timer id. */&lt;/p&gt;
&lt;p&gt;static void
motor_timeout_handler(void * p_context) {
if (m_motor_left) {
app_pwm_disable(&amp;amp;PWM1);	
app_pwm_enable(&amp;amp;PWM2);
m_motor_left = false;
} else {
app_pwm_disable(&amp;amp;PWM2);	
app_pwm_enable(&amp;amp;PWM1);
m_motor_left = true;
}
}&lt;/p&gt;
&lt;p&gt;void pwm_init() {
ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(5000L, M1, M4);
pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;&lt;/p&gt;
&lt;p&gt;err_code = app_pwm_init(&amp;amp;PWM1, &amp;amp;pwm1_cfg, NULL);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;app_pwm_config_t pwm2_cfg = APP_PWM_DEFAULT_CONFIG_2CH(5000L, M3, M2);
pwm2_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;&lt;/p&gt;
&lt;p&gt;err_code = app_pwm_init(&amp;amp;PWM2, &amp;amp;pwm2_cfg, NULL);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;app_timer_create(&amp;amp;m_motor_timer_id,
APP_TIMER_MODE_REPEATED,
motor_timeout_handler);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;void motor_stop(void) {
app_pwm_disable(&amp;amp;PWM1);
app_pwm_disable(&amp;amp;PWM2);
app_timer_stop(m_motor_timer_id);&lt;/p&gt;
&lt;p&gt;m_mode = IDLE;
}&lt;/p&gt;
&lt;p&gt;void motor_tune(motor_mode level) {
m_motor_left = true;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app_pwm_disable(&amp;amp;PWM1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;app_pwm_disable(&amp;amp;PWM2);&lt;/p&gt;
&lt;p&gt;while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, 50) == NRF_ERROR_BUSY);
APP_ERROR_CHECK(app_pwm_channel_duty_set(&amp;amp;PWM1, 1, 50));&lt;/p&gt;
&lt;p&gt;while (app_pwm_channel_duty_set(&amp;amp;PWM2, 0, 50) == NRF_ERROR_BUSY);
APP_ERROR_CHECK(app_pwm_channel_duty_set(&amp;amp;PWM2, 1, 50));&lt;/p&gt;
&lt;p&gt;app_pwm_enable(&amp;amp;PWM1);
app_timer_start(m_motor_timer_id, MOTOR_PERIOD, NULL);&lt;/p&gt;
&lt;p&gt;m_mode = level;
}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50652?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2016 09:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ece13d22-0e01-4761-9946-e11cc01e8e52</guid><dc:creator>zhao</dc:creator><description>&lt;p&gt;In my previous codes, I user four CCs of TIMER_1: when the timer come
to CC[0] I enable LU and RD;
to CC[1] I disable LU and RD;
to CC[2] I enable RU and LD;
to CC[3] I disable RU and LD, also the timer is cleared by short CC[3] and clear task, so the procedure is continued.
However, unfortunately my code is not work with BLE connected.
So, could you please guide me how to use pwm library or pwm driver to implement it safely.
Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50653?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2016 08:20:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49f19a02-121b-46a7-bcbb-6c3121b9afbc</guid><dc:creator>zhao</dc:creator><description>&lt;p&gt;Hi Stefan, I&amp;#39;m trying to use pwm library in SDK 10.0.0. One problem is I want to drive &amp;#39;H&amp;#39; bridge which has 4 arms. let&amp;#39;s call them LU for the left up arm and LD for the left down one and RU and RD, respectively.
I need to implement below function: in the first period, I enable LU and RD, and disable RL and LD; in the next period , disable LU and RD, enable RL and LD, alternatively. I need to adjust the duty time for the period when I want to modify the motor strength.
The problem is I saw the pwm library can only support 2 GPIOTE channel by one pwm instance. If I use two pwm, how to make sure they are working correctly without overlap period. I think two pwm instances are independency, are they?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50650?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 13:51:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a431fa68-a78d-49a4-9c8f-65ef6c1037f4</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;No, S110 development is discontinued and S130 replaces it. If you want to use SDK 11.0.0, use it with S130 2.0.0. See the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf51/dita/nrf51/compatibility_matrix/nRF51422_nRF51822_ic_rev_sdk_%20sd_comp_matrix.html?cp=2_0_3"&gt;nRF51 compatibility matrix&lt;/a&gt; what hardware, softdevices and SDKs are compatible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50649?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 13:47:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9075e547-d016-4c84-b0cd-866e11bcbea7</guid><dc:creator>zhao</dc:creator><description>&lt;p&gt;Thanks, Stefan. I will try SDK 11.0.0 and the pwm library later.
I saw the newest softdevice is V8.0.0, is it ok to work with SDK 11.0.0 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: unexpected system reset when triggerring pwm with ble connected</title><link>https://devzone.nordicsemi.com/thread/50647?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 12:48:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30690acd-9f2b-4efa-a56b-c0f6417ef043</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;In order to get reliable PWM using nRF51, I would advise you to not attempt to code this manually. We have had multiple iterations on the pwm_library and it seem that it was finally stable in nRF51 SDK 10.0.0. So I recommend to use the PWM library provided in &lt;a href="http://developer.nordicsemi.com/nRF5_SDK/"&gt;nRF51 SDK&lt;/a&gt; 10.0.0 or later. There are examples in SDK 11.0.0, the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/pwm_hw_example.html?cp=4_0_0_4_5_15"&gt;pwm_driver&lt;/a&gt;, the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/pwm_example.html?cp=4_0_0_4_5_16"&gt;pwm_library&lt;/a&gt;, and the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/low_power_pwm_example.html?cp=4_0_0_4_5_10"&gt;low_power_pwm&lt;/a&gt; examples. Info on those examples is discussed somewhat on this thread.&lt;/p&gt;
&lt;p&gt;Some pwm example with softdevice is available on &lt;a href="https://devzone.nordicsemi.com/question/62942/buzzer-beep-in-immediate-alert-service/"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>