<?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>Feeding an application timer?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66910/feeding-an-application-timer</link><description>Hi, 
 My use case is I have an RGB LED that I want to be green for normal operation, but blink red for 0.5s when a serial driver error occurs. 
 R, G, and B are each attached to a separate GPIO pin. 
 How I am planning to do this is: 
 
 
 And the timeout_handler</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Oct 2020 13:23:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66910/feeding-an-application-timer" /><item><title>RE: Feeding an application timer?</title><link>https://devzone.nordicsemi.com/thread/274912?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 13:23:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:741b0d2d-cb51-4da8-b62f-bcc355fdc12b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There is no standardized way to do this, as all applications will have different requirements and resources. You need to define some test-cases that will be&amp;nbsp;is expected to put the larges amount of pressure on&amp;nbsp;your application, in terms of high activity, interrupt handling delays, etc.&lt;/p&gt;
&lt;p&gt;You can check the utilization of the atomic FIFO using the head and tail parameters of the&amp;nbsp;nrf_atfifo_t instance, which is created inside the&amp;nbsp;NRF_ATFIFO_DEF() macro. You can also just make sure that you do not get the NO_MEM during the stress-testing. You should anyway implement some way of handling this error, in case it should happen anyway in a corner-case you have not thought about.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Feeding an application timer?</title><link>https://devzone.nordicsemi.com/thread/274735?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 17:39:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd181e48-73e6-4a3f-851d-bc4516ffe5eb</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Thanks for the recommendation Jorgen.&lt;/p&gt;
[quote userid="14926" url="~/f/nordic-q-a/66910/feeding-an-application-timer/274509#274509"]I would recommend that you profile the FIFO usage in your application during stress-testing to determine the max utilization of the FIFO[/quote]
&lt;p&gt;How do I do this? If you also have links to other resources that explain how to do stress-testing, that would be very helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Feeding an application timer?</title><link>https://devzone.nordicsemi.com/thread/274509?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 08:32:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f69f2a39-f1c4-4d40-aeb5-8291126f58d5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;A single FIFO is shared by all timers created in the app_timer library. The main limitation is the available RAM in your application/chip. Larger FIFO size will require more static memory.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would recommend that you profile the FIFO usage in your application during stress-testing to determine the max utilization of the FIFO, and then add some margin on top of that .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Feeding an application timer?</title><link>https://devzone.nordicsemi.com/thread/274454?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 06:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df87be54-44b7-452d-8390-d513be8a5248</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Thank you so much for the helpful answer, Jorgen.&lt;/p&gt;
&lt;p&gt;I see the default queue size is 10, does that mean up to 10 start/stop timer operations can be queued at once, for all timers in the application? Or is this per timer instance?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1602568756477v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Is there a practical upper bound or recommended max for how big this queue can be?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Feeding an application timer?</title><link>https://devzone.nordicsemi.com/thread/274033?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 12:23:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeba92f5-7f2f-4e01-bff0-f7aeab75420b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]1. how much memory does this queue have, and how much memory does one app_timer_start() or app_timer_stop() operation take?[/quote]
&lt;p&gt;You can configure the size of the operation queue in your sdk_config.h file by setting&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__app__timer__config.html#ga3cae0236c8e963755ec625e44d5b71be"&gt;APP_TIMER_CONFIG_OP_QUEUE_SIZE&lt;/a&gt;. This will create an atomic FIFO holding elements of type&amp;nbsp;timer_req_t which holds a pointer to the timer instance and the request type:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief Timer requests types.
 */
typedef enum
{
    TIMER_REQ_START,
    TIMER_REQ_STOP,
    TIMER_REQ_STOP_ALL
} app_timer_req_type_t;

/**
 * @brief Operation request structure.
 */
typedef struct
{
    app_timer_req_type_t type;    /**&amp;lt; Request type. */
    app_timer_t *        p_timer; /**&amp;lt; Timer instance. */
} timer_req_t;

/* Request FIFO instance. */
NRF_ATFIFO_DEF(m_req_fifo, timer_req_t, APP_TIMER_CONFIG_OP_QUEUE_SIZE);&lt;/pre&gt;&lt;/p&gt;
[quote user=""]2. is there a way to modify the timer register to feed the timer directly?[/quote]
&lt;p&gt;As far as I can see, there is currently no such functionality in the app_timer implementation.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>