<?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>Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67022/unable-to-add-freertos-to-thread-secure-dfu-example</link><description>I ported the Thread Secure DFU example to use FreeRTOS, however I get a hard fault if something is scheduled using the app_timer provided. 
 Calling coap_dfu_trigger or handling a bsp button press results in 
 
 
 Can the app_timer/app_scheduler from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Oct 2020 09:20:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67022/unable-to-add-freertos-to-thread-secure-dfu-example" /><item><title>RE: Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/thread/275296?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 09:20:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5bc0719-699d-4cbe-9c04-cd37d27ac84c</guid><dc:creator>pdgendt_bas</dc:creator><description>&lt;p&gt;Ok, so I dropped FreeRTOS for now&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/thread/275056?ContentTypeID=1</link><pubDate>Thu, 15 Oct 2020 11:40:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:945c1d0a-dfaa-4c3f-af99-f88beb5e1e9c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I understand your efforts, but this is something we have not tested in an RTOS setup.&lt;/p&gt;
&lt;p&gt;There are tons of checks withing the FreeRTOS kernel that might not like a context to be executed within a critical section. I think that is what is happening in your case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have not seen how the app_scheduler is used in this dfu example, If&amp;nbsp;app_sched_event_put is not used from many different contexts, it should not hard to phase out app_scheduler and use a separate task and a semaphore/mutex to change the execution context from one to another in freertos.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/thread/274908?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 13:12:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d51e24d9-ee4d-4bb1-a01a-099d28d94340</guid><dc:creator>pdgendt_bas</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/67022/unable-to-add-freertos-to-thread-secure-dfu-example/274846#274846"] Did you inherit some legacy code that uses[/quote]
&lt;p&gt;I wanted to port the secure dfu example which uses app_timer/app_scheduler to work with freertos.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/thread/274846?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 10:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa3cf2a4-0f5a-42ca-94c2-378bb7fa7794</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote userid="93945" url="~/f/nordic-q-a/67022/unable-to-add-freertos-to-thread-secure-dfu-example"]Can the app_timer/app_scheduler from nRF SDK be used together with FreeRTOS?&amp;nbsp;[/quote]
&lt;p&gt;Hi, You should be using app_timer_freertos.c instead of using the app_timer.c (most likely you already know that).&lt;/p&gt;
&lt;p&gt;It should be ok to use app_timer_freertos/app_scheduler along with freertos. For me, in an architectural point of view, it is not necessary to use app_scheduler in an rtos environment. This module was created in a baremetal(non rtos based applications) to be able to change the context from one to the other. But in rtos you already have a tasks/thread concept which you should use instead of app_scheduler.&lt;/p&gt;
&lt;p&gt;I do not see any conflicts in your FreeRTOSConfig.h in terms of priority settings. Also it is not clear exactly what triggered the hardfault. Can you see if the hardfault instructions address is inside the protocol stack or in the application? It looks like a misuse of app_scheduler in a higher context which it is not supposed to be used. Why are you using app_scheduler in an RTOS environment? Did you inherit some legacy code that uses app_scheduler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to add FreeRTOS to Thread Secure DFU example</title><link>https://devzone.nordicsemi.com/thread/274540?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2020 09:13:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ad8141e-091f-4c51-9979-30cead1ef553</guid><dc:creator>pdgendt_bas</dc:creator><description>&lt;p&gt;Using the document &amp;quot;&lt;span&gt;Analyzing HardFaults on Cortex-M CPUs (AN00016)&amp;quot;, I think it&amp;#39;s related to priorities for interrupts.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Stepping out of the hard fault shows:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x120/__key/communityserver-discussions-components-files/4/pastedimage1602580393782v1.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;With RADIO IRQ prio set to 0:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1602587321143v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Which is higher (lower number) then&amp;nbsp;configMAX_SYSCALL_INTERRUPT_PRIORITY&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have these in FreeRTOSConfig.h;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_PRIO_APP_LOWEST&lt;/code&gt;&lt;br /&gt;&lt;code&gt;#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY&amp;nbsp; _PRIO_APP_HIGH&lt;/code&gt;&lt;br /&gt;&lt;code&gt;#define configKERNEL_INTERRUPT_PRIORITY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;configLIBRARY_LOWEST_INTERRUPT_PRIORITY&lt;/code&gt;&lt;br /&gt;&lt;code&gt;#define configMAX_SYSCALL_INTERRUPT_PRIORITY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>