<?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>Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99420/questions-about-freertos-and-rtc-on-nrf52832</link><description>Hi all, 
 I am having an issue with FreeRTOS on the NRF52832 (SDK 17.1.0). 
 I need precise time so I use the io to measure the time. the code like this: 
 
 #define configTICK_RATE_HZ 1024 
 But the oscilloscope waveform shows that the interval is abnormal</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 May 2023 05:40:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99420/questions-about-freertos-and-rtc-on-nrf52832" /><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424404?ContentTypeID=1</link><pubDate>Tue, 09 May 2023 05:40:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94cb501a-fe7b-47f7-a92b-1f47425c3f65</guid><dc:creator>Lurn_Z</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;In this link&amp;nbsp;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/99420/questions-about-freertos-and-rtc-on-nrf52832/424234"]&lt;p&gt;&lt;span&gt;Here is the link:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/wireless-timer-synchronization-among-nrf5-devices" data-contentid="52adcbee98c04ae0ae1927a5a8473b8e" data-contenttypeid="f7d226abd59f475c9d224a79e3f0ec07" class="ui-contentpeek internal-link"&gt;Wireless timer synchronization among nRF5 devices&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;[/quote]
&lt;p&gt;I found some IRQ_handler called by softdevice. But I didn&amp;#39;t use the softdevice, I only use the ESB and not BLE, And I searched for some information, the timeslot looks like it should be used in BLE(I think).&lt;/p&gt;
&lt;p&gt;So how to handle it?&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Lurn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424370?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 19:07:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bbd7b7d-d0ac-4268-992b-9206f56b0e18</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Discussion around device synchronization&amp;nbsp;will continue in this thread:&amp;nbsp;&amp;nbsp;(Missing Forum Thread)&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424328?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 14:12:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e43b089c-6eb4-41e9-aea8-60d28384de4b</guid><dc:creator>Lurn_Z</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;After communicating the requirements,&amp;nbsp;my colleagues and I believe that the focus of the problem should be on how to synchronize the three devices. Of course, time accuracy is also important, but it should be placed after synchronization.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this link, it shows how to sync the clock, and I will learn how to implement it, but I also have a question, after sync the time,&amp;nbsp;How can I confirm that the two TX devices are separate? Like TX A&amp;nbsp;&lt;span&gt;at an odd time, TX B at even time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Lurn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424234?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 11:25:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:178f5654-2f2e-41e0-bc93-d1b23de769ab</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Lurn,&lt;/p&gt;
&lt;p&gt;The time resolution with&amp;nbsp;&lt;span&gt;vtaskdelay is limited by the RTC clock source (32768/1024) so you should use another timer source if you need more accuracy. Preferably with PPI if possible.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here is the link:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/wireless-timer-synchronization-among-nrf5-devices"&gt;Wireless timer synchronization among nRF5 devices&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424131?ContentTypeID=1</link><pubDate>Mon, 08 May 2023 02:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:906f7c1e-0554-4a32-a8b4-a788f14cd0ba</guid><dc:creator>Lurn_Z</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Actually, what i want to do is that I have 1 PRX and 2 PTX, and I want to synchronize the timer of the 3 devices via ESB.&lt;/p&gt;
&lt;p&gt;Then make sure that the time points when the two TXs send data are separated to ensure that the data does not conflict(due to I need real-time data, I can&amp;#39;t use the esb retransmit). And The sending interval of each TX is 2MS. It&amp;#39;s looks like&amp;nbsp;the sending time of TX 1 to be at an odd time, another at even time.&lt;/p&gt;
&lt;p&gt;So I want to do it with clock synchronization, but now I can&amp;#39;t achieve precise 2ms time synchronization.&lt;/p&gt;
&lt;p&gt;Maybe what I&amp;#39;m doing is not right, because I&amp;#39;m just trying, so I should need to say what I want to do so that you can correctly understand whether I&amp;#39;m trying to go in the right direction.&lt;/p&gt;
&lt;p&gt;So did PPI can help me to do this?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/36354/about-ppi"&gt;In this link&lt;/a&gt;, @haakonsh said it can use a propriatary 2.4GHz protocol to synchronize nordic devices, but the link he shared is lost, can you give me a new link about it?&lt;/p&gt;
&lt;p&gt;And will it solve my problem? If it doesn&amp;#39;t work out, can you give me a better suggestion?&lt;/p&gt;
&lt;p&gt;Update:&lt;/p&gt;
&lt;p&gt;Can I use the timeslot to do this? If I can use it, can you give me a example about it. my project didn&amp;#39;t use the SoftDevice,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Lurn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424107?ContentTypeID=1</link><pubDate>Sat, 06 May 2023 07:10:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:400fc650-b4d9-4eb9-98d6-a860c061d3bc</guid><dc:creator>Lurn_Z</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Another qusetions.&lt;/p&gt;
&lt;p&gt;1.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/99420/questions-about-freertos-and-rtc-on-nrf52832/424036"]I would recommend using busy waits (nrf_delay_us())[/quote]
&lt;p&gt;If i use the nrf_delay_ms(time1); Can Freertos schedule tasks at this time? I need rtos to schedule tasks in this time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I saw&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/30401/what-is-more-efficient-use-nrf_delay_us-or-timer-hfclk-for-1-us"&gt;in this link&lt;/a&gt;&amp;nbsp;@Edvin said the PPI is&amp;nbsp;very accurate, and in my project, since I&amp;#39;m using ESB and UARTE, I&amp;#39;m also using HFCLK.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Can I also use the PPI in FreeRTOS? Can it trigger the ESB write payload and send it? Can I use it to sync time between two devices?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Lurn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424096?ContentTypeID=1</link><pubDate>Sat, 06 May 2023 01:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfe80c19-2a88-4b10-9194-034b26eda292</guid><dc:creator>Lurn_Z</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;If I want to use the function vTaskDelayUntil how to handle it. Beacuse I want to ensure a constant execution frequency and the interval is 2ms/ 1ms.&lt;/p&gt;
&lt;p&gt;And I used TIMER to test, but I get something crash, but in thread while loop is ok,&amp;nbsp;probably due to some interrupt issues,&amp;nbsp;but I haven&amp;#39;t checked in detail now.&lt;/p&gt;
&lt;p&gt;Update:&lt;/p&gt;
&lt;p&gt;As you said I use timer to test the interval, every&amp;nbsp;&lt;span&gt;interval is 1.82ms.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Should I use the nrf timer APP_TIMER_DEF() ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;xTimerCreate(&amp;quot;DataTimer&amp;quot;,
            pdMS_TO_TICKS(2),
            pdTRUE,
            0,
            TimerFunc);

void TimerFunc(TimerHandle_t xTimers)
{
    static uint8_t flag = 0;
    nrf_gpio_pin_write(18, flag);
    if(flag)
        flag = 0;
    else
        flag = 1;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Update 2:&lt;/p&gt;
&lt;p&gt;when I use two timer to change the IO state.&lt;/p&gt;
&lt;p&gt;I found that the two timers always set the IO at same time. so I print the tick, and it shows the count is same.I want to set one of it&amp;nbsp;at odd numbers, another at even number. How to do this?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // start timer 
    xTimerStart(testTimer, 0);
    nrf_delay_ms(1);
    xTimerStart(testTimer2, 0);
    
    
    // in timer func
    nrf_gpio_pin_write(18, 0);
    TickType_t tetsttick = xTaskGetTickCount();
    printf(&amp;quot;pulldown tick = %d.&amp;quot;, tetsttick);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/tick_5F00_number.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Lurn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about FreeRTOS and RTC on nrf52832</title><link>https://devzone.nordicsemi.com/thread/424036?ContentTypeID=1</link><pubDate>Fri, 05 May 2023 13:59:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de928a66-6e8b-4bb7-aee2-78df4386e0bd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The time resolution of vtaskdelay is limited by the&amp;nbsp;&lt;span&gt;configTICK_RATE_HZ from the RTC. For short accurate delays I would recommend using busy waits (nrf_delay_us()). When you factor in the processing overhead associated with context switching, I don&amp;#39;t think the power consumption difference will be significant.&amp;nbsp;Another alternative is to use a TIMER instance.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>