<?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 set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69910/how-to-set-up-the-scheduler-on-nrf51822</link><description>Hello Team, 
 I want to use scheduler to schedule two tasks i.e task_1 and task_2. The task_1 and task_2 are as follow: 
 void task_1() { printf(&amp;quot;Task 1 ran&amp;quot;); } 
 void task_2() { printf(&amp;quot;Task 2 ran&amp;quot;); } 
 Now I want to use the scheduler to schedule this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Jan 2021 09:52:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69910/how-to-set-up-the-scheduler-on-nrf51822" /><item><title>RE: How to set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/288575?ContentTypeID=1</link><pubDate>Tue, 12 Jan 2021 09:52:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f950db28-6181-4fa5-bf90-7edf1e16c836</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please try to use &lt;a href="https://www.nordicsemi.com/Software-and-tools/Software/nRF5-SDK/Download#infotabs"&gt;nRF5 SDK 12.3.0&lt;/a&gt; instead. It&amp;#39;s the latest version that includes support for the nRF51 series (&lt;span&gt;&lt;a title="SDKs and SoftDevices " href="https://infocenter.nordicsemi.com/topic/comp_matrix_nrf51/COMP/nrf51/nRF51422_nRF51822_ic_rev_sdk_sd_comp_matrix.html?cp=5_0_5"&gt;SDKs and SoftDevices&lt;/a&gt;&lt;/span&gt;). You may also want to check the return values from your function calls to detect any errors.&lt;/p&gt;
&lt;p&gt;e.g.,&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;strong&gt;uint32_t&lt;/strong&gt; err_code = app_timer_create(&amp;amp;m_timer_id, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_TIMER_MODE_SINGLE_SHOT,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_timeout_handler);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;strong&gt;APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Also, in case you have not seen it, here is a tutorial explaining how to use the app scheduler: &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/scheduler-tutorial"&gt;https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/scheduler-tutorial&lt;/a&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/288131?ContentTypeID=1</link><pubDate>Fri, 08 Jan 2021 10:38:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aff10709-3cce-4809-bfba-e6ca3c34c35d</guid><dc:creator>JuzerT</dc:creator><description>&lt;p&gt;Hi Vidar Berg,&lt;/p&gt;
&lt;p&gt;I tried adding the above line to my code but still it is not working. Is their any thing else that i may be missing as i have tried a lot but still it is not working.&lt;/p&gt;
&lt;p&gt;Is their any issue with the sdk means i am using old sdk i.e sdk8 is this causing any issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/287696?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 11:18:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a5356e2-eac1-4995-be86-e62b38614f58</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to start the low freqeuncy 32KHz clock source before starting your app timer, the timer will not run without it. To start the timer you can add the following line at the beginning of main()&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/287052?ContentTypeID=1</link><pubDate>Thu, 31 Dec 2020 09:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f4a2a5e-6b33-4c8f-97eb-0fe60ce55eb6</guid><dc:creator>JuzerT</dc:creator><description>&lt;p&gt;Tools:&lt;br /&gt;software: keil version 5&lt;br /&gt;SDK version: SDK8 (available with keil u5, i.e default Nordic SDK available with keil software for nRF51822)&lt;/p&gt;
&lt;p&gt;STEPS:&lt;br /&gt;I have used the UART example from pack installer and have added the following code to impliment my logic of printing &amp;quot;Task 1 ran&amp;quot; on completing the 15sec timer.&lt;/p&gt;
&lt;p&gt;#define APP_TIMER_PRESCALER 0 /**&amp;lt; Value of the RTC1 PRESCALER register. */&lt;br /&gt;#define APP_TIMER_OP_QUEUE_SIZE 4 /**&amp;lt; Size of timer operation queues. */&lt;br /&gt;#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t)&lt;br /&gt;#define SCHED_QUEUE_SIZE 10&lt;/p&gt;
&lt;p&gt;APP_TIMER_DEF(m_timer_id);&lt;/p&gt;
&lt;p&gt;//void * p_context; /**&amp;lt; General purpose pointer. Will be passed to the timeout handler when the timer expires. */&lt;br /&gt;static void timer_timeout_handler(void * p_context)&lt;/p&gt;
&lt;p&gt;{&lt;br /&gt; //Do something&lt;br /&gt; printf(&amp;quot;Task 1 ran\n&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void function2(void)&lt;br /&gt;{&lt;br /&gt; //Stop timer if called&lt;br /&gt; app_timer_stop(m_timer_id);&lt;br /&gt; printf(&amp;quot;fuction1 running timer stopped.\n&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void function1(void)&lt;br /&gt;{&lt;br /&gt; //Start 15s timer if called&lt;br /&gt; app_timer_start(m_timer_id, APP_TIMER_TICKS(15000, APP_TIMER_PRESCALER),NULL);&lt;br /&gt; printf(&amp;quot;fuction1 running timer started.\n&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;int main(void)&lt;br /&gt;{&lt;br /&gt; APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, true);&lt;br /&gt; &lt;br /&gt; uint8_t err_code = app_timer_create(&amp;amp;m_timer_id, &lt;br /&gt; APP_TIMER_MODE_SINGLE_SHOT,&lt;br /&gt; timer_timeout_handler);&lt;br /&gt; &lt;br /&gt; APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);&lt;br /&gt; printf(&amp;quot;function1.\n&amp;quot;);&lt;br /&gt; function1();&lt;br /&gt; &lt;br /&gt; while (true)&lt;br /&gt; {&lt;br /&gt; app_sched_execute();&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;my code compiled successfully and Now when I run the code, on serial monitor I got the following message:&lt;br /&gt;&amp;quot;function1.&lt;br /&gt;function1 running timer started.&amp;quot;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s it &lt;br /&gt;My timer_timeout_handler is not executed and not printing &amp;quot;Task 1 ran&amp;quot; on serial monitor&lt;/p&gt;
&lt;p&gt;Now what I was thinking that when my timer of 15sec gets over it calls timer_timeout_handler and thus after 15sec it should print &amp;quot;Task 1 ran&amp;quot; but it is not.&lt;/p&gt;
&lt;p&gt;what I am doing wrong can you please explain.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up the scheduler on nRF51822</title><link>https://devzone.nordicsemi.com/thread/286735?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 14:17:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fb2274a-94bf-46cb-96ee-55eb27819df4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The app scheduler included with the SDK is a very basic scheduler (&lt;span&gt;&lt;a title="Schedule handling library" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/lib_scheduler.html?cp=7_5_9_3_27"&gt;Schedule handling library&lt;/a&gt;&lt;/span&gt;), and does not support creation and scheduling of tasks/threads. If you need this, I suggest you look at the Freertos examples we have: &lt;span&gt;&lt;a title="Heart Rate Application with FreeRTOS" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/ble_sdk_app_hrs_freertos.html?cp=7_5_9_4_2_2_10"&gt;Heart Rate Application with FreeRTOS&lt;/a&gt;&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>