<?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>Setup Input Capture in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74248/setup-input-capture-in-zephyr</link><description>Hello, can you please provide more information and instructions on how we configure the input capture on nrf52840 dev board using zephyr? All sample examples only cover pwm output. I have a square signal that I would like to capture the time associated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Apr 2021 06:32:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74248/setup-input-capture-in-zephyr" /><item><title>RE: Setup Input Capture in Zephyr</title><link>https://devzone.nordicsemi.com/thread/306467?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 06:32:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd67a4f4-f2a6-47cd-a719-f2ffc217ad75</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>[quote user="moose"]Any plans to enable the input capture feature of the zephyr PWM driver?[/quote]
&lt;p&gt;There&amp;#39;s no natural way of implementing this into the driver, without depending on other drivers and external setup.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="moose"]The event can be either HItoLO, LOtoHI, or TOGGLE. The toggle event would have worked except when we route it through a PPI channel to a timer capture register; either transition will update the capture register. Any idea on how to do this? Thx![/quote]
&lt;p&gt;Connect the signal to two GPIOs, one that is configured hitolow, and the second that is configured lotohi.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setup Input Capture in Zephyr</title><link>https://devzone.nordicsemi.com/thread/306459?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 05:39:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf356678-0644-4fdb-a13a-55a4057de808</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Thank you for the info. Any plans to enable the input capture feature of the zephyr PWM driver?&lt;/p&gt;
&lt;p&gt;Meanwhile, we have created the code to capture the time associated with input signal transitions referencing the nrfx example you shared. We got it working, but it&amp;nbsp;is not exactly what we want. We need to capture the time of both the rising and falling edges of the same input signal. It looks like we can only generate one event per GPIO pin. The event can be either HItoLO, LOtoHI, or TOGGLE. The toggle event would have worked except when we route it through a PPI channel to a timer capture register; either transition will update the capture register. Any idea on how to do this? Thx!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setup Input Capture in Zephyr</title><link>https://devzone.nordicsemi.com/thread/306085?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 12:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e55596d-87c8-41d0-9707-727875cd59f8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The PWM&amp;nbsp;port for nrf devices does not have capture capabilities:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/pwm/pwm_nrfx.c#L263-L266"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/pwm/pwm_nrfx.c#L263-L266&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thus it will return an error code if you try to call _capture() call:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/include/drivers/pwm.h#L221"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/include/drivers/pwm.h#L221&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;functionality you are after must be implemented using a TIMER, GPIOTE IN, and PPI, something like this one for nrf53/nrf91 (note: uses dppi, while the nrf52-series have ppi):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx_timed_signal/src/main.c"&gt;https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx_timed_signal/src/main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>