<?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>&amp;quot;app_timer&amp;quot;,&amp;quot;pwm_library&amp;quot;,&amp;quot;nrf_drv_timer &amp;quot;can not coexist</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52615/app_timer-pwm_library-nrf_drv_timer-can-not-coexist</link><description>&amp;quot;app_timer&amp;quot; 
 
 
 &amp;quot;pwm_library&amp;quot; 
 
 
 &amp;quot;nrf_drv_timer &amp;quot; 
 
 
 main 
 
 nRF5_SDK_14.0.0_3bcc1f7 
 
 as above hree pieces of code, if put them together with softdevice, i can get fault when run to &amp;quot;main()-------init_pwm();//-----------------------2&amp;quot; 
 debug</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Sep 2019 08:39:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52615/app_timer-pwm_library-nrf_drv_timer-can-not-coexist" /><item><title>RE: "app_timer","pwm_library","nrf_drv_timer "can not coexist</title><link>https://devzone.nordicsemi.com/thread/212210?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2019 08:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:864e9148-c09d-4d8f-98e6-c0f80190e3c0</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I think this is caused by how the timer instances are defined in the driver. In nrf_drv_timer.h in SDK 14.0.0, the instances are all defined, and the instance number is assigned depending on the previous index and the enable config. If the timer is not enabled in the config, it will receive the same index as the previously enabled timer.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define TIMER0_INSTANCE_INDEX 0
#define TIMER1_INSTANCE_INDEX TIMER0_INSTANCE_INDEX+TIMER0_ENABLED
#define TIMER2_INSTANCE_INDEX TIMER1_INSTANCE_INDEX+TIMER1_ENABLED
#define TIMER3_INSTANCE_INDEX TIMER2_INSTANCE_INDEX+TIMER2_ENABLED
#define TIMER4_INSTANCE_INDEX TIMER3_INSTANCE_INDEX+TIMER3_ENABLED&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In SDK 15.x.0, with the introduction of NRFX driver, the instance is only defined if the timer is enabled, generating a compile error when you try to use the timer:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;enum {
#if NRFX_CHECK(NRFX_TIMER0_ENABLED)
    NRFX_TIMER0_INST_IDX,
#endif
#if NRFX_CHECK(NRFX_TIMER1_ENABLED)
    NRFX_TIMER1_INST_IDX,
#endif
#if NRFX_CHECK(NRFX_TIMER2_ENABLED)
    NRFX_TIMER2_INST_IDX,
#endif
#if NRFX_CHECK(NRFX_TIMER3_ENABLED)
    NRFX_TIMER3_INST_IDX,
#endif
#if NRFX_CHECK(NRFX_TIMER4_ENABLED)
    NRFX_TIMER4_INST_IDX,
#endif
    NRFX_TIMER_ENABLED_COUNT
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Luckily the state checking in the code will provide you with an error, preventing the driver for running both libraries on the same timer. That would cause unpredictable behavior.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "app_timer","pwm_library","nrf_drv_timer "can not coexist</title><link>https://devzone.nordicsemi.com/thread/212154?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2019 01:15:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:727e98cc-7ad3-4553-8844-442644e149d1</guid><dc:creator>Diiiiiii</dc:creator><description>&lt;p&gt;yes yes,you are right,i forget that. but, why didn&amp;#39;t keil give errors？&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "app_timer","pwm_library","nrf_drv_timer "can not coexist</title><link>https://devzone.nordicsemi.com/thread/211975?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2019 08:29:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e23a69c-4e89-4401-8c87-5f295b101bb7</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you made sure to enable both TIMER1 and TIMER2 in your sdk_config.h file?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;q&amp;gt; TIMER1_ENABLED  - Enable TIMER1 instance

#ifndef TIMER1_ENABLED
#define TIMER1_ENABLED 1
#endif

// &amp;lt;q&amp;gt; TIMER2_ENABLED  - Enable TIMER2 instance

#ifndef TIMER2_ENABLED
#define TIMER2_ENABLED 1
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If this does not work, can you upload your project for us to reproduce the issue?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>