<?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>SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72731/softdevice-hard-fault-while-porting-to-mesh</link><description>Using S132 v7.2, I&amp;#39;m getting a hard fault at PC 0x00015810 (I see the flag set in SEGGER, and the console outputs a SOFTDEVICE ASSERT FAILED error) that I&amp;#39;m working on manually tracing. I&amp;#39;m borrowing some code from another project of ours to get this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Mar 2021 07:53:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72731/softdevice-hard-fault-while-porting-to-mesh" /><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/301120?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 07:53:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2af68529-1a6a-411f-a662-b88f48e17a40</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the update. Yes, that could actually be the issue. If the clock accuracy settings are better than what you actually have, that could very well lead to issues. As noted by @kevin-rees this is not a hardfault, but rather the SoftDevice asserting. (In this instance the SoftDevice detected that timing requirements were not met, jeopardizing Bluetooth specification compliance.)&lt;/p&gt;
&lt;p&gt;You might want to look into that accuracy. Depending on LF clock source, check that you are using the correct:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;capacitance (in case of external xtal; note that correct component values varies depending on xtal.) See the &lt;a href="https://infocenter.nordicsemi.com/pdf/nwp_015.pdf"&gt;Crystal Oscillator Design Considerations White Paper&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__sdh__config.html&amp;amp;anchor=ga83081258fb562e6f06bf9ff66851797c"&gt;NRF_SDH_CLOCK_LF_RC_TEMP&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__sdh__config.html&amp;amp;anchor=ga7992d0564d149ff30a4d36fc81a6f127"&gt;NRF_SDH_CLOCK_LF_RC_CTIV&lt;/a&gt; (in case of internal RC oscillator.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300797?ContentTypeID=1</link><pubDate>Fri, 19 Mar 2021 01:04:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1504041e-7156-4ffd-a7a9-d89d6fd81674</guid><dc:creator>mdh</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/tesc"&gt;tesc&lt;/a&gt;, we were able to resolve this issue by altering the setting of NRF_SDH_CLOCK_LF_ACCURACY from 7 down to 4 to loosen up timing requirements.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300541?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 23:20:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:557969d8-37fd-4d4c-86e9-12b2757481f0</guid><dc:creator>Kevin Rees</dc:creator><description>&lt;p&gt;A SoftDevice assertion isn&amp;#39;t necessarily a HardFault (it almost certainly isn&amp;#39;t in fact, because HardFaults come through a separate handler I believe). It just means that the SD error checking has caught a state it doesn&amp;#39;t think should happen, so it propagates up to the application handler (that was registered on initialization)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300540?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 22:54:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce9959b9-6627-4f3a-8026-95829ca03254</guid><dc:creator>Kevin Rees</dc:creator><description>&lt;p&gt;Hi Terje,&lt;/p&gt;
&lt;p&gt;I work with &lt;a href="https://devzone.nordicsemi.com/members/mdh"&gt;mdh&lt;/a&gt; and I am starting to look into this issue with him.&lt;/p&gt;
&lt;p&gt;A few notes so far on your previous questions/suggestions:&lt;/p&gt;
&lt;p&gt;1. We have upgraded multiple other projects successfully to mesh, and none of them have had this problem.&lt;/p&gt;
&lt;p&gt;2. Yes, we are using FreeRTOS in our projects, and yes that does complicate things quite a bit. We have some of the MESH SDK and nRF5 SDK files patched to support it, and we have extensive library code that simplifies the setup and running of the core code that we share between our projects. We have mesh event polling and SD event processing running sequentially on the same thread, and modifications to app_timer and other files to make things play nice with FreeRTOS. We also have mutexes and other guards preventing certain asynchronus accesses to the mesh stack to prevent specific crashes we have seen arise due to the multi-threading. At this point we have mesh operating very well with FreeRTOS on our other projects, so it is unlikeley that it is the direct cause of the current issue on this project.&lt;/p&gt;
&lt;p&gt;3. As far as interrupt priorities, we should not be using anything different that what is working in the other projects. As far as disabling interrupts, that is a good question. I don&amp;#39;t think so, but we can look into that more.&lt;/p&gt;
&lt;p&gt;I have been doing my own testing on this issue, and so far I haven&amp;#39;t been able to track down the exact cause of the fault either. I do know that if I don&amp;#39;t start mesh (mesh_stack_start()) it doesn&amp;#39;t crash. Also the fault is not happening immediately, it happens around 12 seconds after startup, so it isn&amp;#39;t happening during the mesh start or other initialization. This timing is very consistent, and doesn&amp;#39;t seem to coincide with anything specific in our code (that I know of anyway).&lt;/p&gt;
&lt;p&gt;Is there a way to get more information about the nature of the ASSERT in the SoftDevice?&lt;/p&gt;
&lt;p&gt;Is there any particular event that happens at about 12 seconds (a timeout or something) that could give us a clue? Either in the SoftDevice, or the mesh stack?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Kevin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300520?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 19:16:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6933c9a7-f123-4bee-946c-c6ac08a03090</guid><dc:creator>mdh</dc:creator><description>&lt;p&gt;Terje, here&amp;#39;s a screenshot of the details I pulled from Ozone. I enabled every fault handler that I could that still reproduced the original error (the UNALIGN_TRP is caught several times if I enable it, but the primary HardFault isn&amp;#39;t generated), and I find myself a bit confused, because as best as I can tell, I&amp;#39;m getting an unspecified HardFault that&amp;#39;s not a Usage, Memory, or BusFault. I&amp;#39;m digging through the refs you just sent - to clarify, this is a project currently using the nRF5 SDK that&amp;#39;s being ported to exclusively use mesh. It also includes FreeRTOS, which has definitely complicated things.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screenshot of hardFault exception details from Ozone" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-2021_2D00_03_2D00_17-094913.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300488?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 15:45:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a04dcbe9-970b-473b-ae22-3a58ed16872c</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Right. Is this a project mixing nRF5 SDK and nRF5 SDK for Mesh? If so, i recommend having a look at &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_doc_user_guide_integrating_mesh_nrf5_sdk.html"&gt;Integrating Bluetooth mesh into nRF5 SDK examples&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If FreeRTOS is also part of the mix, then I am afraid things might get a bit more complicated and take some more time for me to answer. Feel free to ask anyway, if something is unclear.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300483?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 15:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56d8678e-fe13-467f-89bb-7a37cbe83497</guid><dc:creator>mdh</dc:creator><description>&lt;p&gt;Still hunting around - I&amp;#39;m somewhat new on this project and still learning the ropes of both FreeRTOS and the SDKs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/300479?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 15:27:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7788377f-5402-4d32-a59d-e77516967749</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did you find anything related to interrupts, or are there still issues to be solved?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/299872?ContentTypeID=1</link><pubDate>Mon, 15 Mar 2021 15:17:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e998f2be-e497-4d30-bf1c-bc8afe55b197</guid><dc:creator>mdh</dc:creator><description>&lt;p&gt;Tusen takk Terje. I&amp;#39;ll look into those and make sure they&amp;#39;re all set up correctly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice hard fault while porting to mesh</title><link>https://devzone.nordicsemi.com/thread/299833?ContentTypeID=1</link><pubDate>Mon, 15 Mar 2021 14:16:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e97a6e1-39a0-4470-9eec-4fa935128bc2</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This assert is most likely the mesh stack failing to give the radio back to the SoftDevice in time (i.e. overstaying the timeslot.)&lt;/p&gt;
&lt;p&gt;First thing to check would be &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v5.0.0%2Fmd_doc_user_guide_mesh_interrupt_priorities.html"&gt;interrupt priorities&lt;/a&gt;: Have you configured the mesh stack correctly? Are you calling any of the mesh stack API from the wrong context? Also, are you by any chance using timeslots yourself, or disabling interrupts anywhere?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>