<?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>ble_app_gzll &amp;amp; freeRTOS &amp;amp; peer manager</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27049/ble_app_gzll-freertos-peer-manager</link><description>Hi 
 I am running some thing similar to the multiprotocol ble_app_gzll example but using freeRTOS and peer manager. Effectively the the main in ble_app_gzll example is a freeRTOS task. 
 
 The first issue I came across was reinitialising ble. (ie this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Sep 2017 13:37:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27049/ble_app_gzll-freertos-peer-manager" /><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106249?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 13:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51ea50f0-61e3-4033-b353-e7b02a93df35</guid><dc:creator>cp52</dc:creator><description>&lt;p&gt;When are the start up routines run? On power up?  Is this still true if we go in to low power mode and then come back out of it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106248?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 13:29:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb567661-c905-4faa-9b1a-7ec419a2b463</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;m_users is a static variable and is zero-initialized by the startup routines when the program starts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106247?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 02:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19810190-a302-44a7-9d4c-28b9b4ca03ba</guid><dc:creator>ypearson</dc:creator><description>&lt;p&gt;I&amp;#39;m having a similar issue, I had to patch app_timer_freertos.c to allow re-initialization.&lt;/p&gt;
&lt;p&gt;Any new insights ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106246?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 12:33:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaae61e7-7ba6-4137-aa16-490bc5f4f0bf</guid><dc:creator>cp52</dc:creator><description>&lt;p&gt;Another recommendation:
There is no initial state for m_n_registrants. It should be set to 0 in the initialisation and probably when it is defined. Otherwise I dont think can we guarantee its value on start up.
static uint8_t                       m_n_registrants = 0;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106243?ContentTypeID=1</link><pubDate>Mon, 28 Nov 2016 13:24:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:648278a0-8a65-4702-83d2-74bd57c3d62b</guid><dc:creator>cp52</dc:creator><description>&lt;p&gt;Unfortunately I cant do this as we are using the other timers and RTC&amp;#39;s.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106245?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 14:57:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8333e8b9-558c-4ada-9aff-6f239d8370d6</guid><dc:creator>cp52</dc:creator><description>&lt;p&gt;Ok So here are the fixes for running peer manager when you need to stop and restart the Ble app&lt;/p&gt;
&lt;p&gt;Note: my project is based on the ble_app_hrs_freertos which has been modified to behave like the ble_app_gzll project so that the ble stack can be stoped and started&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ble_conn_state_init(); needs to be run on the initialization of the ble. Before the peer manager in initialised. This clears all the flags other wise the pm_init()-&amp;gt;gcm_init() can not acquire them.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;ble_app_hrs_freertos: (tested)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add ble_conn_state_init(); to the static void ble_init(void) function&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;ble_app_gzll project: (not tested)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ble_app_gzll_hr.c -&amp;gt; Add ble_conn_state_init(); to the void ble_stack_start(void)function&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Non urgent as I can fix this myself as it is not part of an SDK library/component.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;2)m_n_registrants needs to be reset to 0 on initialisation. This clears the event handlers and allows new ones to be registered using the pm_register(pm_evt_handler). Other wise each time the peer_manager_init() is run it will register the event again and fill up the buffer.&lt;/p&gt;
&lt;p&gt;Please can a fix\ patch be put in for this. I need a way of setting m_n_registrants to 0.
Urgent as it requires a change to the peer manager which is a SDK library/component.&lt;/p&gt;
&lt;p&gt;This could either be done in ret_code_t pm_init(void) or by making a new function to clear events. Im not fussed.&lt;/p&gt;
&lt;p&gt;3)There is now a third issue with the fds module. It is the same scenario as in the peer manager.&lt;/p&gt;
&lt;p&gt;at no point is m_users set to 0! This could be a bug if the memory location at m_users is not 0 on start up!&lt;/p&gt;
&lt;p&gt;in my opinion this should be set to 0 when initialized and in the fds_init() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106241?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 10:36:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3972e643-9eeb-482e-a2dc-8bffc0d3c3b6</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then use the patch and use app_timer.c instead of app_timer_freeRTOS.c . Then you will still have the exact same behavior you had when you were not using FreeRTOS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106244?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 09:44:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e189c472-d976-479b-8bfd-17829662c7a8</guid><dc:creator>cp52</dc:creator><description>&lt;p&gt;As I see it we have one app_Timer header file and we can select the implementation app_timer.c or app_timer_freertos.c or app_timer_rtx.c by compiling the one we want ( by adding it to the makefile)&lt;/p&gt;
&lt;p&gt;I am currently using app_timer_freertos.c and it is this that has the problem. The problem comes when is run for the second time the freertos timer has already been created and so the handle is not null. The issue is that the timer isnt deleted and there is no way of doing this.&lt;/p&gt;
&lt;p&gt;ble_app_gzll uses the app_timer.c. This isnt creating a new timer when app_timer_create() is called as it is modifying a timer that is already there so I think this is why it works.&lt;/p&gt;
&lt;p&gt;In app_timer_freertos.c if I ignore that error I think it still works as it just uses the timer that was created the first time it was called and luckily the handle is still the same. I have just changed the code to make a delete timer function and this does fix the problem. It will be a major headache implementing this as currently there is no sensible place to run the delete function in the current architecture.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_gzll &amp; freeRTOS &amp; peer manager</title><link>https://devzone.nordicsemi.com/thread/106242?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 08:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2def6c55-2922-4405-9852-c40948ba6b6f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;FreeRTOS and app_timer.c both uses RTC1. Can you use app_timer_freertos.c instead of app_timer.c? The first one uses RTOS timers instead of RTC1&lt;/p&gt;
&lt;p&gt;I am not sure if the second problem is related FreeRTOS?&lt;/p&gt;
&lt;p&gt;I am attaching a patch for SDK12.1, that will make FreeRTOS use RTC2 instead of RTC1, incase you still want to use app_timer.c instead of app_timer_freertos.c, keeping you app functionally same.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/change_5F00_freeRTOS_5F00_to_5F00_use_5F00_rtc2_5F00_isntead_5F00_of_5F00_rtc1.patch"&gt;change_freeRTOS_to_use_rtc2_instead_of_rtc1.patch&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>