<?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 Prescaler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7437/timer-prescaler</link><description>I have a nRF51 DK board and its flashed with the SD 110 
 I want to have a timer which will interrupt every 50us. 
 This is how I set up the timer: 
 #define APP_TIMER_PRESCALER 4 
#define APP_TIMER_MAX_TIMERS (3 + BSP_APP_TIMERS_NUMBER) 
#define</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Jul 2015 12:34:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7437/timer-prescaler" /><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26484?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:34:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8662dc3-e6e8-4955-a100-a11fdf3bc8be</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Great, Have fun with your new toy :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26483?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:31:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fef1653-4366-4383-be03-80070ec04ed0</guid><dc:creator>Inspectron</dc:creator><description>&lt;p&gt;Ok. I will accept your answer. Because I will now work with the nRF52.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26482?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:28:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c577a89-261a-4646-9fef-0c84cd35b7c2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Things are faster on nRF52, but if you are using the library and driver functions, then it should not be that difficult. But please do not combine the questions regarding nRF52 in this thread as the discussion is purely nRF51&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26481?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:23:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37181002-8533-4fed-a332-6a9be52662fd</guid><dc:creator>Inspectron</dc:creator><description>&lt;p&gt;@Aryan I have now the new nRF52 preview board. How fast I can set up my protocol with the new board? I will attach a picture of that protocol, which I try to reproduce.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26480?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 11:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ad6e148-bece-47e1-bc65-afbc08fd3c08</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Inspectron, could you please update this thread with latest info, if any answer helped you then please click the ✓ to the left of the answer so that others can come and look here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26478?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 09:58:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99054a65-2f72-4a4a-9bde-6b88fb573fe0</guid><dc:creator>Eirik Aa</dc:creator><description>&lt;p&gt;You might want to consider a second controller for handling this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26476?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 08:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d5527f5-6377-44a6-a8e6-dd2b360ab6a6</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;ok - if you check you&amp;#39;ll find multiple posts every week from people trying to use timer interrupts to do precise timing/bitbanging operations while the softdevice is running. Most of them aren&amp;#39;t even trying for something like 50µs either, they are trying to do timing operations measured in milliseconds. The softdevice, when doing anything bluetooth, interrupts constantly, has higher priority than anything else in the system and your interrupts will be delayed constantly and randomly by milliseconds at a time.&lt;/p&gt;
&lt;p&gt;I just googled the LIN bus protocol, the timing requirements seem very strict and it&amp;#39;s a 1-wire protocol so you&amp;#39;re really going to have a hard time bitbanging it with the softdevice doing anything. Well more than a hard time. Have you looked into a creative use of the UART or even SPI hardware to fake the protocol, at least you have some hardware support there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26473?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 08:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d92f9960-a313-48d6-86b7-67c9a6d4f637</guid><dc:creator>Inspectron</dc:creator><description>&lt;p&gt;I want to use the Soft Device, because the reason why I want to replace the black box with a nRF Chip is, that I want to control the table with a mobile device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26474?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 08:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43323349-1a0f-4f54-bced-242cc315490d</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and you&amp;#39;re not going to be using the softdevice whilst you&amp;#39;re doing this, ie doing anything with bluetooth? As long as you&amp;#39;re not - shouldn&amp;#39;t be a problem. If you want to do this while the softdevice is going, it&amp;#39;s not going to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26475?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 08:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b10c34d-c01a-453d-8893-fda4c725618e</guid><dc:creator>Inspectron</dc:creator><description>&lt;p&gt;I have a Black box which will control tables. The Black box communicate with the LIN Bus protocol. But its not standart. Every Signal has to be 50us high/low. So I need to change the level of the Signal every 50us.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26477?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 07:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:721e90b9-adea-4be5-9601-8b6f758843bb</guid><dc:creator>Eirik Aa</dc:creator><description>&lt;p&gt;May I ask why you need a 50uS timer? Perhaps things can be done differently?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26486?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 07:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d904e32d-a204-4299-8e99-f07fdc777efd</guid><dc:creator>Inspectron</dc:creator><description>&lt;p&gt;Yes I`m working now on this. Thanks for the information&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26485?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2015 07:02:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b1f7efc-af4e-4fe7-9be8-55e5bb2d9431</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Try and use nrf_driver_timer.h with Timer1. The fastest tick it can give is in 62.5ns. You should be able to achieve 50us.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Prescaler</title><link>https://devzone.nordicsemi.com/thread/26479?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2015 13:27:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:851f3f3b-e58c-4d02-add8-ae6eb430923e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes that&amp;#39;s correct.&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;Why do you think changing the prescalar would change the time when the APP_TIMER_TICKS() macro is documented thusly (the headers contain so much information they are always worth looking at)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**@brief Convert milliseconds to timer ticks.
 *
 * @note This macro uses 64 bit integer arithmetic, but as long as the macro parameters are
 *       constants (i.e. defines), the computation will be done by the preprocessor.
 *
 * @param[in]  MS          Milliseconds.
 * @param[in]  PRESCALER   Value of the RTC1 PRESCALER register (must be the same value that was
 *                         passed to APP_TIMER_INIT()). 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The entire POINT of that macro is to generate the correct number of ticks for a number of milliseconds. If you change the PRESCALAR, the macro generates a different number of ticks in order to do what you&amp;#39;ve asked for, give you 50ms.&lt;/p&gt;
&lt;p&gt;You can&amp;#39;t use the app timer to generate 50us ticks anyway. Again looking at the documentation of the functions in the header file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**@brief Function for starting a timer.
 *
 * @param[in]  timer_id        Id of timer to start.
 * @param[in]  timeout_ticks   Number of ticks (of RTC1, including prescaling) to timeout event
 *                             (minimum 5 ticks).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;5 ticks of a 32768Hz clock is 153us with the prescalar at 0, that&amp;#39;s the minimum you can get with app timers. If you want something faster you&amp;#39;ll have to go use the other sort of timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>