<?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>Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80857/timer-with-a-constant-and-stable-period</link><description>Hello! 
 
 I am trying to sample a digital signal with 12-bits (In a later stage I will need to sample two 12-bits signals). At the moment I am storing the recorded signal in an SD card, but the final goal is to send it via BLE. For this purpose, I was</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Oct 2021 08:55:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80857/timer-with-a-constant-and-stable-period" /><item><title>RE: Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/thread/335017?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 08:55:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0692ca77-ee5b-409a-8c2d-1ebbb644ac91</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;It is no problem at all, Thiago - I am happy to hear that you found my answers useful!&lt;br /&gt;&lt;br /&gt;Please do not hesitate to open another ticket if you should encounter any other issues or questions in the future.&lt;br /&gt;&lt;br /&gt;Good luck with your development!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/thread/335014?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 08:51:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75f195e9-8933-4c56-a481-475ffd608f11</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Thank you for the useful answers, Karl. I will try&amp;nbsp;to apply your suggestions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/thread/335007?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 08:28:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ef40eab-61d1-4540-b0aa-502c2d716717</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Oh, I understand - what you are looking for then is &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fgpiote.html"&gt;the GPIOTE peripheral&lt;/a&gt;&amp;nbsp;which is GPIO with tasks and events. The reason for this compartmentalization is so that you could achieve lower power consumption in the case that you only need to toggle GPIO&amp;#39;s, without actually needing the tasks and events part.&lt;/p&gt;
[quote user="Thiago"]Also, the sampled value should be stored in an array for later SD card storage&amp;nbsp;or BLE transmission. Any idea how could it be done?[/quote]
&lt;p&gt;Storing in an array might fill up your RAM, depending on how much you will be storing between each transfer.&lt;br /&gt;Regarding storing to flash we have got some libraries for this, namely &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_fstorage.html"&gt;fstorage&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_fds.html"&gt;FDS&lt;/a&gt;&amp;nbsp;which you could look into using. We have also got examples demonstrating the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/fds_example.html"&gt;usage of the FDS&lt;/a&gt;&amp;nbsp;library and the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/fstorage_example.html"&gt;fstorage library&lt;/a&gt;&amp;nbsp;which could be helpful to have a look at to see how this could be done.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/thread/335006?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 08:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5727c8e2-ea7a-43ac-8d9c-5d2e31eb9761</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Thank you for the response, Karl.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What I don&amp;#39;t get is what task should I configure the PPI to perform to read the GPIO_IN register. Other peripheral have TASK registers, but not the GPIO. Also, the sampled value should be stored in an array for later SD card storage&amp;nbsp;or BLE transmission. Any idea how could it be done?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer with a constant and stable period</title><link>https://devzone.nordicsemi.com/thread/335002?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2021 08:04:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91d43f8e-abfb-4f22-9851-2428174b3a70</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;You are correct that you will need to use the PPI peripheral to perform periodic sampling. The reason for this is that when you use the CPU to trigger the sampling you never really know when the task will be triggered - since the CPU might be busy with higher priority tasks. This is especially the case when you have enabled the SoftDevice, since the SoftDevice will take control of the CPU whenever it has a timing-critical deadline to meet, such as an upcoming BLE event.&lt;br /&gt;&lt;br /&gt;The PPI peripheral allows you to connect an event to a task trigger, effectively having the task be triggered without any CPU intervention. This is what allows you to do periodic sampling. You could see this &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrf_dev_saadc_example.html"&gt;demonstrated in the SAADC peripheral example&lt;/a&gt;, in which PPI is used to connect the TIMER&amp;#39;s CC event to the SAADC SAMPLE task - triggering a sampling every time the timer event occurs, completely without CPU interaction.&lt;br /&gt;You could also take a look at &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples/tree/v17.0.2/ble_app_uart__saadc_timer_driven__scan_mode"&gt;this example by my colleague which demonstrates how to perform periodic sampling and send the measurements over a BLE connection afterwards&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>