<?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>How to read frequency of pulse signal in GPIO pin?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107470/how-to-read-frequency-of-pulse-signal-in-gpio-pin</link><description>I have a custom board using nRF52832, s132 softdevice and nRF5 SDK. I would like to add a new circuit on my board, that will contain a 555 timer which gives as output signal a pulse stream. The aim is to measure the frequency of the pulse. If I have undrestood</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Jan 2024 15:54:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107470/how-to-read-frequency-of-pulse-signal-in-gpio-pin" /><item><title>RE: How to read frequency of pulse signal in GPIO pin?</title><link>https://devzone.nordicsemi.com/thread/464666?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 15:54:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecadf2f5-1bf5-4833-8947-d31ab1abef02</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;We have a similar case where you can find examples&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/34547/ppi-configuration-to-count-pulses/133136"&gt;(+) PPI Configuration to Count Pulses - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&amp;nbsp;similar to your queries.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read frequency of pulse signal in GPIO pin?</title><link>https://devzone.nordicsemi.com/thread/464604?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 13:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b514e5ac-9c40-4489-b4c7-267907f88a04</guid><dc:creator>Meh</dc:creator><description>&lt;p&gt;8Mhz = 8,000,000Hz, 2.4GHz = 2,400,000,000Hz, so GPIO won&amp;#39;t damage any BLE transmission.&lt;/p&gt;
&lt;p&gt;Although I&amp;#39;m developing in nRF Connect SDK, and the last time I dealt with nRF5 was a few years ago, here is the general flow:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;

#define YOUR_GPIO_PIN 13 // Replace with your specific GPIO pin number

#define FREQUENCY_TO_DELAY(f)   ((1000 / (f)) / 2)

void gpio_init(void) {
    nrf_gpio_cfg_input(YOUR_GPIO_PIN, NRF_GPIO_PIN_PULLUP);
}

uint32_t gpio_status;

void read_gpio_status(void) {
    gpio_status = nrf_gpio_pin_read(YOUR_GPIO_PIN);
    // Now, gpio_status contains the status (0 or 1) of the GPIO pin.
}

int main(void) {
    gpio_init();

    while (1) {
        read_gpio_status();
        nrf_delay_ms(FREQUENCY_TO_DELAY(f));   //Replace f with your desired sampling frequency - if you have higer sampling frequency than 1kHz, multiply this macro by 1000 and use nrf_delay_us function instead)
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;More info and a good tutorial about the topic with nRF5:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=zFANmKZFMrc"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read frequency of pulse signal in GPIO pin?</title><link>https://devzone.nordicsemi.com/thread/464574?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 11:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3253609-5b56-4f18-b130-27d1ab695d66</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;Thank you for your response.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;1.&amp;nbsp;Do you have in mind&amp;nbsp;any example or code that could help me develop this?&lt;br /&gt;&lt;br /&gt;2. What about 10kHz mentioned in this link&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/101412/nrf52-clarification-on-low-frequency-i-o-for-input"&gt;nrf52, clarification on Low Frequency I/O for input&lt;/a&gt;&amp;nbsp;that will probably affect radio?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read frequency of pulse signal in GPIO pin?</title><link>https://devzone.nordicsemi.com/thread/464566?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 11:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e0ee2c6-2df9-4290-85e5-743433cd8027</guid><dc:creator>Meh</dc:creator><description>&lt;p&gt;1. Make sure the interval between readings complies with the Nyquist rule - so if your max 555 frequency is 1kHz, you need to have no more than 0.5ms between two readings - but this is a very edgy value. I recommend you sample at the top 0.25ms between samples (for a maximum 1kHz signal).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2. BLE signals are around 2.4GHz (2.402-2.480 if I remember correctly). GPIO top speed at nRF52832 is 8MHz - so there is no expected interference with BLE. Theoretically, suppose you have GPIO that can communicate in BLE rates. In that case, it will cause interference issues, which might cause you to lose or unwillingly modify values or the packets you send over BLE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>