<?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>Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54063/removing-connection-parameter-negotiation-ble-library-from-ble_peripheral-ble_app_uart-example-app</link><description>Hello ... 
 Implementing an app for both nRF51822 and nRF52810 and need a long-term clock with 100 Hz counter frequency to timestamp sensor events. By long-term, I mean at least 5 hours. I&amp;#39;m using TIMER1 and TIMER2 for other timing functions, so that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Dec 2019 17:11:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54063/removing-connection-parameter-negotiation-ble-library-from-ble_peripheral-ble_app_uart-example-app" /><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/224796?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 17:11:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:302dd8b5-797c-4d71-8c83-5d418c1b9064</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;A bit more info ...&lt;/p&gt;
&lt;p&gt;If I add nrf_delay_ms(50) after NRF_RTC1-&amp;gt;TASKS_STOP=1 and before NRF_RTC1-&amp;gt;PRESCALER=255, it appears that the prescaler is set correctly every time. Still, though, I&amp;#39;m concerned about using RTC1 before ble_conn_params.c/app_timer have finished using it.&lt;/p&gt;
&lt;p&gt;Thx!&lt;br /&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/224789?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 16:42:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92fad5d6-52c5-42f6-a7f3-0fa8a86a86f2</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thanks mrono. I agree, somehow writing my own app_timer would be ideal. I&amp;#39;m new to low-level BLE and Nordic SDK and do not understand ble_conn_params.c well enough to safely do this. I&amp;#39;ve noticed that on the occasions where PRESCALER is 0 after I set it to 255, about 3 seconds later app_timer&amp;#39;s RTC1 interrupt routine (RTC1_IRQHandler()) is called. This, I think, suggests that following successful connection between central and peripheral, a timer created by ble_conn_params.c is still running and a timeout or CC event occurs.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d be grateful for any guidance on either 1) removing use of ble_conn_params.c and implementing connection parameter negotiation myself (and hence removing its dependence on RTC1, or at least knowing how it uses RTC1 so I can be sure my app&amp;#39;s use of it doesn&amp;#39;t interfere (or vice versa), or, as you say, 2) implement my own reduced version of app_timer. How to go about that?&lt;/p&gt;
&lt;p&gt;Appreciate any guidance. Many thanks,&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/224665?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 10:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eab59000-9e47-47a4-b4e5-b8e06f9827ab</guid><dc:creator>mrono</dc:creator><description>&lt;p&gt;I think the simplest way would be to implement your own reduced version of app_timer, and replace the calls to app_timer_start/stop in ble_conn_parameters with your own functions. Then you&amp;#39;d be in complete control over RTC1.&lt;/p&gt;
&lt;p&gt;If it is only the conn_params -module that needs app_timer, then you could even restrict your implementation to only have one timeout running at a time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/224605?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 07:28:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e24a5851-c3c7-4121-b519-ce0d9d9167d4</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;I thought I had a solution for this, but need to revisit.&lt;/p&gt;
&lt;p&gt;Experiencing an intermittent issue whereby somehow RTC1&amp;#39;s prescaler is being set to 0. My app was built by starting with ble_app_uart and removing uart and customizing. Here&amp;#39;s how my app currently utilizes RTC1:&lt;/p&gt;
&lt;p&gt;1) Following connection between BLE peripheral and central (ble_evt_handler(..) receives BLE_GAP_EVT_CONNECTED in p_ble_evt-&amp;gt;header.evt_id), peripheral and central exchange a bit of data (nus_data_handler(..) to receive from central, ble_nus_data_send(..) to send to central).&lt;/p&gt;
&lt;p&gt;2) At this point my app assumes that ble_conn_params.c is done using app_timer/RTC1, and proceeds to set up and start RTC1 with prescaler 255:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_RTC1-&amp;gt;TASKS_STOP = 1;   // Stop RTC1
NRF_RTC1-&amp;gt;TASKS_CLEAR = 1;  // Clear RTC1
NRF_RTC1-&amp;gt;PRESCALER = 255;  // Set RTC1 prescaler
NRF_RTC1-&amp;gt;TASKS_START = 1;  // Start RTC1

NVIC_ClearPendingIRQ(RTC1_IRQn);
NVIC_DisableIRQ(RTC1_IRQn);

uint16_t current_prescaler = NRF_RTC1-&amp;gt;PRESCALER;
NRF_LOG_INFO(&amp;quot;current_prescaler %d&amp;quot;, current_prescaler);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Sometimes NRF_LOG_INFO shows current_prescaler to be 255, sometimes 0. It seems that even at the point a central/peripheral connection has been established, ble_conn_params.c may still be using app_timer/RTC1. Even though my app sets prescaler to 255, app_timer might be setting it back to 0?&lt;/p&gt;
&lt;p&gt;Is there a way I can know for sure when ble_conn_params.c is done with app_timer/RTC1 so my app can safely use RTC1?&lt;/p&gt;
&lt;p&gt;I guess another option is to not use ble_conn_parameters/app_timer, but I don&amp;#39;t know how to do that. If simple, I&amp;#39;d appreciate the code to do so.&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/219139?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2019 16:48:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6059949-dca8-4b01-91b4-8b00fd636ce9</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;H&amp;aring;kon. I&amp;#39;ll take a closer look at ble_conn_params.c.&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/219037?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2019 11:47:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fa9fb92-9f87-435c-9bf9-7031f47a08e7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;To update your connection parameters, its essentially a call to &amp;quot;sd_ble_gap_conn_param_update&amp;quot; that is performed x amount (configurable) of seconds after the connection has been established - based on if this is needed by the timing that has already been provided to you by the central device. It has a bit more logic in ble_conn_params.c, where it for instance handles retries.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/218896?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2019 15:58:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b1a56c4-f768-458b-8fcc-ba3156a49445</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;H&amp;aring;kon. I&amp;#39;ll proceed with currently working solution. However, I&amp;#39;d still be curious about how to handle connection parameters without the Connection Parameters Negotiation library, as suggested in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/305/rtc0-rtc1-and-the-app_timer-with-softdevice" rel="noopener noreferrer" target="_blank"&gt;this post&lt;/a&gt;:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;You should however note that the connection parameters module isn&amp;#39;t strictly required, since you can send connection parameter update requests manually by using the softdevice API directly. All modules using app_timer are optional, and you can just avoid using them.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I have a feeling this might be quite involved. Thanks either way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing Connection Parameter Negotiation BLE library from ble_peripheral ble_app_uart example app</title><link>https://devzone.nordicsemi.com/thread/218837?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2019 13:18:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06fd0e0e-2fb9-4da5-9ff2-2ac966f4b2da</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I&amp;#39;ve implemented this and it appears to work well but I&amp;#39;m concerned about the risk of manipulating RTC1 while ble_conn_params.c is using app_timer/RTC1.[/quote]
&lt;p&gt;&amp;nbsp;The RTC1 peripheral is only used by app_timer, and if you, in your application, have total control over when the app_timer uses it, I do not see any reasons why you shouldn&amp;#39;t go forward with that.&lt;/p&gt;
&lt;p&gt;If you can use the same prescaler in app_timer as in your application, you could also modify app_timer.c (irq handler) to check other events than EVENTS_COMPARE[0], as app_timer only uses CC[0] to handle its own queue, so if you ensure that app_timer newer stops the RTC, and you modify the irq-handler; you can use those other CC&amp;nbsp;instances freely.&lt;/p&gt;
&lt;p&gt;That being said; If you have a solution that already works, I wouldn&amp;#39;t change it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>