<?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>FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75472/fds_gc-causes-hard-fault</link><description>I&amp;#39;m using SDK 16.0, Soft device 340 v6.1.1, chip nRF52833. Currently no bootloader loaded, but I do use the secure bootloader with light mods. BLE stack and ANT stack are disabled when this occurs. System is basically idle. 
 This is quite odd. This has</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 May 2021 12:08:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75472/fds_gc-causes-hard-fault" /><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/312076?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 12:08:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc675e40-43f0-47fd-bb9c-f10d2df6288b</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="brett_anderson"]Is there a reason that the soft device would assert instead of just returning FDS_ERR_TIMEOUT?[/quote]
&lt;p&gt;The SoftDevice assert happens when it runs and sees that more time has elapsed than what it scheduled (so typically it would have missed a BLE or ANT event, or other task that should have allready been performed). If for instance the flash.&lt;/p&gt;
[quote user="brett_anderson"]I have no problem dropping the max write size down to 256, and allowing it to use multiple cycles to complete the update/gc. Maybe the default should be way lower than 4096?[/quote]
&lt;p&gt;Yes, I believe that the value should be lower in case you write large chunks of data. This has been an issue before as well, where long flash operations would cause SoftDevice asserts. Perhaps you are also seeing the limitation that &amp;quot;Flash write operations may exceed the timeout provided when performed with certain protocol operations (e.g. ANT Continuous Scan).&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/311821?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 13:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71c304f1-a2ef-4468-8b9b-bbb1771eee88</guid><dc:creator>brett_anderson</dc:creator><description>&lt;p&gt;Thank you for that info! At most, I&amp;#39;m only writing 112 bytes plus record overhead. I guess GC would be erasing a page.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there a reason that the soft device would assert instead of just returning FDS_ERR_TIMEOUT? It seems odd that it would crash the system. I get it, just wondering the best way to mitigate the issue. I have no problem dropping the max write size down to 256, and allowing it to use multiple cycles to complete the update/gc. Maybe the default should be way lower than 4096?&lt;/p&gt;
&lt;p&gt;Thank you for the discussion. I know I search these pages a lot, and this info will definitely help someone else.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/311819?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 13:08:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:757e6eeb-b01b-4c01-b388-5ec9ccec47b0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The assert at&amp;nbsp;0x5450 in S340 6.1.1 is a &amp;quot;overstay event&amp;quot;, which is typically caused by the application blocking the SoftDevice for too long, for instance (but not limited to) a flash operation taking longer time than the SoftDevice scheduled. The assert does not give any information about what blocked the SoftDevice, though.&lt;/p&gt;
&lt;p&gt;Reducing the maximum write size could make sense if long flash writes is the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/311530?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 14:23:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0436615-89f7-4322-a9a7-2c04eec8fdb7</guid><dc:creator>brett_anderson</dc:creator><description>&lt;p&gt;Sorry, I realize that was confusing.&lt;/p&gt;
&lt;p&gt;My build script built using sd 340 v7.0.2. That build failed as soon as I pressed a button. (button presses are tracked in the statistics record, and saved to flash)&lt;/p&gt;
&lt;p&gt;When I connected a debugger and removed the bootloader (for easier debugging) I mistakenly loaded s340 v6.1.1.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;S340 v6.1.1 reported the PC was 0x5450 in the hard fault handler. I read a post that said the actual calling function was from SP+14, and this value was consistently 0x2C331 when at the breakpoint in the hard fault handler.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Things I changed trying to fix it:&lt;/p&gt;
&lt;p&gt;- I was calling fds_gc from the update success event. I moved this to a flag that gets called only when the system is idle. It is no longer being called from the event callback.&lt;/p&gt;
&lt;p&gt;- I decreased the virtual pages to 5 from 10. I really only need 3.&lt;/p&gt;
&lt;p&gt;- I decreased the max write size from 4096 to 1024&lt;/p&gt;
&lt;p&gt;- I increased the max retries from 8 to 16&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;None of these things was able to make S340 v6.1.1 happy. When I re-programmed with S340 v7.0.2, it worked.&lt;/p&gt;
&lt;p&gt;I would love to understand what was failing if possible. Did I fix it? S340 v7.0.2 was failing until I did something, so what did I do that made the difference so I can document it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/311476?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 13:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e4c82d4-10a4-41d9-8909-219d7355460b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Just to be clear, do you get an assert at&amp;nbsp;0x5450 or 0x2C331, and with which exact SoftDevice version and variant?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS_GC causes hard fault</title><link>https://devzone.nordicsemi.com/thread/311177?ContentTypeID=1</link><pubDate>Sun, 23 May 2021 03:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c95ec4ba-ec41-499e-81e6-ea0560a8ea38</guid><dc:creator>brett_anderson</dc:creator><description>&lt;p&gt;OK, some quick corrections and updates.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First, the error was reported in the hard fault handler, not app error. Wouldn&amp;#39;t let me edit.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Second, I realized that I had the wrong soft device. I use a build script, and I originally saw the problem on a device after deploy with the build script. I then did a bunch of testing searching for the problem, using the wrong version of the soft device. The script was using v7.01, but I was trying to debug with 6.1.1. I just switched the debug back to v7.01, and it works.&lt;/p&gt;
&lt;p&gt;Then I ran the build script again, and it worked. I am so confused.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still curious if anyone tell me what the assert was that failed, in v6.1.1. I&amp;#39;m worried I have a race condition or something. We are close to going to production, and this is not the time to find this type of problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m going to leave this open for now, hoping someone from Nordic wants to chime in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>