<?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>Using nrfx drivers with Zephyr device tree</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115126/using-nrfx-drivers-with-zephyr-device-tree</link><description>I&amp;#39;d like to use playback feature of PWM. There is NRFX function for that: nrfx_pwm_complex_playback(). This function, like other NRFX drivers, needs appropriate instance structure, here it&amp;#39;s nrfx_pwm_t. The instance variable can be created with NRFX_PWM_INSTANCE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Oct 2024 13:41:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115126/using-nrfx-drivers-with-zephyr-device-tree" /><item><title>RE: Using nrfx drivers with Zephyr device tree</title><link>https://devzone.nordicsemi.com/thread/504709?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2024 13:41:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:589502b5-790a-49d6-88c9-db926129c8d0</guid><dc:creator>grzegorz</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Yes, I know I can use the nrfx driver and I have seen this example. My concern is the coexistence of device tree and nrfx. For example I have the PWM pin configured in device tree. With nrfx I need to configure it second time with NRFX_PWM_DEFAULT_CONFIG() macro. It&amp;#39;s not flexible and can lead to mistakes. So I&amp;#39;m looking for a way in which nrfx driver could use config from device tree. This is what I came up with:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const struct pwm_dt_spec buzzer = PWM_DT_SPEC_GET(DT_NODELABEL(buzzer_pwm));

const nrfx_pwm_t *pwm = buzzer.dev-&amp;gt;config;
const int PLAYBACK_COUNT = 1;
nrf_pwm_sequence_t seq[2]; //not initialized, but this is just an example
nrfx_pwm_t instance;
instance.p_reg = pwm-&amp;gt;p_reg;
nrfx_pwm_complex_playback(&amp;amp;instance, &amp;amp;seq[0], &amp;amp;seq[1], PLAYBACK_COUNT, NRFX_PWM_FLAG_LOOP);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using nrfx drivers with Zephyr device tree</title><link>https://devzone.nordicsemi.com/thread/504521?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 12:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7da0c6ea-dbe1-4f8b-acaf-873b54c662b3</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;If the Zephyr PWM driver does not fulfill your use-case, you would instead have to use the nrfx driver.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See this example on how to use it in a NCS/Zephyr context:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/samples/src/nrfx_pwm/grouped_mode/main.c"&gt;https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/samples/src/nrfx_pwm/grouped_mode/main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>