<?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>Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115363/reasons-why-bonds-are-deleted</link><description>We have a custom board in production, which is nRF52832, s132, nrf5 SDK. 
 Below I provide you some code regarding the peer manager. We use a static key to pair and connect to the devices. Usually only one device will connect to the board. 
 We recently</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Oct 2024 11:21:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115363/reasons-why-bonds-are-deleted" /><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/506699?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 11:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4b17afb-a70d-4d05-a0e5-f6899b12f781</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;That&amp;#39;s also great thank you very much!!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/506693?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 11:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af201cdd-227c-4ec7-8c7d-2a8176439ea7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for the update. After reviewing the answer you accepted I realize I forgot to include the screenshot showing file line to remove in the flash_placement.xml to make SES only display the size of the application not including the Softdevice.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1729163053618v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/506689?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 10:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a70fe93-5efd-455d-8e49-ecaf03541f74</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;Ok thank you very much for your help and advice!!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think everything is much more clear now, and this development for handling flash, will help&amp;nbsp;so that peer manager will not delete bonds anymore&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Dimitra&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/506682?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 10:13:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cf3767c-2d30-4ea9-bb18-3ae9cbd39551</guid><dc:creator>Vidar Berg</dc:creator><description>[quote user="DimitraN"]After more testing it turns out that words_used include freeable_words.&amp;nbsp;[/quote]
&lt;p&gt;Sorry about this. I reviewed the FDS implementation but overlooked this.&lt;/p&gt;
[quote user="DimitraN"]Since this is how it works, I track only words_used to check if they exceed the limit, and when freeable are a lot I call GC.&amp;nbsp;&lt;br /&gt;Only when words_used exceed the limit and freeable are so few that GC will not help, I delete some records.&amp;nbsp;[/quote]
&lt;p&gt;Sounds good.&lt;/p&gt;
[quote user="DimitraN"]I have 13 virtual pages of 2048 size&amp;nbsp;&lt;br /&gt;If I write 17280 words of A record a day&lt;br /&gt;and 1152 words of B record a day&lt;br /&gt;and let&amp;#39;s say peer manager writes/updates its files twice a day 2*50 words = 100 words a day&amp;nbsp;&lt;br /&gt;and GC is called twice to delete in total around 17280 words (65% of memory)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;then we have:&amp;nbsp;&lt;br /&gt;2046 words * 13 pages = 26598 words&amp;nbsp;&lt;br /&gt;26598 words * 10000 / (2 * 17280 + 1152 + 100) = 7427 days = ~20 years&amp;nbsp;&lt;br /&gt;is this how we could estimate the flash life?[/quote]
&lt;p&gt;Keep in mind that one page is reserved for swap and is not used for data storage. Also, the number of erase cycles per page is what matters most, and this is&amp;nbsp;affected by how often garbage collection is performed. Other than that, the calculation seems to be correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/506664?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 09:10:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:002d167e-6871-49b1-980b-b940d69e5972</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;After more testing it turns out that words_used include freeable_words.&amp;nbsp;&lt;br /&gt;This means that when I delete records, words_used become freeable, therefore freeable are increased and words_used stay the same since a freeable is also a used word. So, words_used will decrease when GC is called and freeable are actually erased.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Since this is how it works, I track only words_used to check if they exceed the limit, and when freeable are a lot I call GC.&amp;nbsp;&lt;br /&gt;Only when words_used exceed the limit and freeable are so few that GC will not help, I delete some records.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/115363/reasons-why-bonds-are-deleted/505907"]From the&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52832/page/abs_max_ratings.html"&gt; &amp;#39;Absolute maximum ratings&amp;#39;&lt;/a&gt;, you can see that the flash is rated for 10 000 write/erase cycles[/quote]
&lt;p&gt;from this&amp;nbsp;if I can calculate the writes/erases&amp;nbsp;&amp;nbsp;of flash:&lt;br /&gt;&lt;br /&gt;I have 13 virtual pages of 2048 size&amp;nbsp;&lt;br /&gt;If I write 17280 words of A record a day&lt;br /&gt;and 1152 words of B record a day&lt;br /&gt;and let&amp;#39;s say peer manager writes/updates its files twice a day 2*50 words = 100 words a day&amp;nbsp;&lt;br /&gt;and GC is called twice to delete in total around 17280 words (65% of memory)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;then we have:&amp;nbsp;&lt;br /&gt;2046 words * 13 pages = 26598 words&amp;nbsp;&lt;br /&gt;26598 words * 10000 / (2 * 17280 + 1152 + 100) = 7427 days = ~20 years&amp;nbsp;&lt;br /&gt;is this how we could estimate the flash life?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505907?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2024 13:43:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21b6f4d4-4619-465c-8aea-c27d2da6aa94</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Dimitra,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;d say too frequent is when you call GC more frequently than necessary. For instance, if you run GC when only 50 % of the memory is used. From the&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52832/page/abs_max_ratings.html"&gt; &amp;#39;Absolute maximum ratings&amp;#39;&lt;/a&gt;, you can see that the flash is rated for 10 000 write/erase cycles.&lt;/span&gt;&lt;/p&gt;
[quote user="DimitraN"]Another question after testing, I delete records when I send them over BLE to mobile.. at this point, I expect that almost all words_used become freeable_words, but sometimes fds_stat returns almost equal amount to both variables, like freeable words are updated and words_used have not been updated yet. is this a case? have you observed this kind of a behaviour?[/quote]
&lt;p&gt;Not that I can remember.&amp;nbsp;Which SDK version are you using?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505868?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2024 10:47:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:503cdd1f-ffd6-45a6-b8bd-e80e6d901d35</guid><dc:creator>DimitraN</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/115363/reasons-why-bonds-are-deleted/505728"]It&amp;#39;s best to not perform GC too frequently as it leads to increased flash wear.[/quote]
&lt;p&gt;But what is too frequently?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We have a record that is updated in fds every 30 seconds all day. This creates 6 freeable words every 30 seconds. 12 freeable words every 1 minute * 60 * 24 = 17280 freeable words a day.&amp;nbsp;&lt;br /&gt;If we call GC for example 2 times a day to free up these words, is it frequently?&lt;br /&gt;&lt;br /&gt;Because the limit I will put is 22400 words, where I consider that flash is full, and I stop saving new records and start deleting old ones.&amp;nbsp; in order to always leave one page available for peer manager, so that it will not delete the bonds..&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So, is 2 times a day calling GC frequent? If yes, then the only thing I can do is call it ONLY when freeable_words + words_used &amp;gt;= limit of 22400.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Another question after testing, I delete records when I send them over BLE to mobile.. at this point, I expect that almost all words_used become freeable_words, but sometimes fds_stat returns almost equal amount to both variables, like freeable words are updated and words_used have not been updated yet. is this a case? have you observed this kind of a behaviour?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dimitra&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505728?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2024 12:35:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9696581b-550d-4d15-be93-cc1aa890bbc8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Dimitra,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s best to not perform GC too frequently as it leads to increased flash wear. Freeable words are not included in words used. Also, if possible, avoid running GC in connections as it can lead to scheduling conflicts. Running GC on this many pages is relatively time consuming.&lt;/span&gt;&lt;/p&gt;
[quote user="DimitraN"]if the limit of &amp;quot;full&amp;quot; space is 100 words. and words used = 100 and freeable = 10, and words used do not include freeable words, then i have exceeded the limit, and I will have a problem even if i call gc.&amp;nbsp;[/quote]
&lt;p&gt;This is correct. So in this case you would have to delete some records to get more &amp;quot;freeable&amp;quot; words.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505711?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2024 11:03:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fea77a97-5d4c-4b96-8017-72c011e75192</guid><dc:creator>DimitraN</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/115363/reasons-why-bonds-are-deleted/505689"]&amp;nbsp;fds_stat_t::words_used includes the page tag.[/quote]
&lt;p&gt;ok, but do words used include dirty words too?&lt;br /&gt;&lt;br /&gt;so if I understand I have 12 pages * (2048 words - 2 words page tag) = 24552 words available to use for my data and for peer manager.&amp;nbsp;&lt;br /&gt;Peer manager uses for one bond (and peer rank, service pending flag etc) 53 words , if I read words_used from fds_stat.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;so let&amp;#39;s say that I want to leave a lot of space available for peer manager, 1 whole page.&amp;nbsp;&lt;br /&gt;the available space&amp;nbsp;becomes: 11 pages * 2046 words = 22506 words.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;do i check then when words_used &amp;gt;= 22506 --&amp;gt; delete some records&amp;nbsp;&lt;br /&gt;or words_used + freeable_words &amp;gt;= 22506 --&amp;gt; delete some records&amp;nbsp;&lt;/p&gt;
&lt;p&gt;because I call regularly GC , and I can see that freeable words become 0 when gc succeeds, but I am not sure whether freeable words are included or not in words used. If they are not included then I must consider them in the calculation.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;e.g. if the limit of &amp;quot;full&amp;quot; space is 100 words. and words used = 100 and freeable = 10, and words used do not include freeable words, then i have exceeded the limit, and I will have a problem even if i call gc.&amp;nbsp;&lt;br /&gt;on the other hand, if words_used =100 and freeable = 10, but they&amp;#39;re included in words_used, then truly I have 90 words and have time to call gc, and then delete extra records when needed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I also want to apologize for the long details, but I have been working on this for a long time and maybe I confuse myself without a reason..&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Best regards,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Dimitra&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505689?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2024 09:37:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f6ad0fd-97d4-40ae-9620-37ad50464a56</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;Dimitra,&lt;/span&gt;&lt;/p&gt;
[quote user="DimitraN"]About pm_handler_flash_clean, do you think it is possible or safe, to change it and make it not delete the last peer (&amp;quot;Deletes the lowest ranked peer(s) when garbage collection is insufficient.&amp;quot;) but rather I delete records to free up space...&amp;nbsp;[/quote]
&lt;p&gt;It is possible, but it may require some rework of the PM implementation. However, if running GC is not sufficient, the bonding will fail. It seems better to avoid this issue altogether by running GC and deleting specific records before reaching this situation.&lt;/p&gt;
[quote user="DimitraN"]Where can I find how much space the Peer Manager needs?&amp;nbsp;&lt;br /&gt;Here&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/lib_fds_functionality.html"&gt;https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/lib_fds_functionality.html&lt;/a&gt;, it says that peer manager uses 0xC000 file IDs and Record keys until 0xFFFF. But how much space does it really need?&amp;nbsp;[/quote]
&lt;p&gt;The size of each bond depends on how many CCCD&amp;#39;s that need to be stored. You can use the fds_stat function before and after pairing to determine the size requirements in your applicaiton.&lt;/p&gt;
[quote user="DimitraN"]Finally, in my application Flash size (project section placement)&amp;nbsp; is 0x5a000 ( = 368640) .&amp;nbsp;&lt;br /&gt;When I build it in Segger Embedded Studio, it says that 233,7 KB are used.&lt;br /&gt;On the other hand, nRF52832 has 512 kB, we use Softdevice (152 kB)&amp;nbsp;and bootloader (24 kB), and then the space left for the application is 336 kB.[/quote]
&lt;p&gt;233.7 kB is including the Softdevice if you are looking at the build output. You can remove this highlighted line in your flash_placement.xml if you want it to only show the size of the app.&lt;/p&gt;
[quote user="DimitraN"]In sdk_config.h, I have set 13 virtual pages (which peer manager also uses), and virtual page size is 2048 words. 1 page it says that is used by GC, so, I have available 2048 * 4 * 12 = 98304 bytes ?&amp;nbsp;&lt;br /&gt;I am a bit confused about the real space that is left for my data and the peer manager, in order to monitor the flash usage and free up space when needed.. Could you help me with this too?&amp;nbsp;[/quote]
&lt;p&gt;One page is reserved for GC, which leaves you with 12 pages * 2048 words for storing data records. Each page uses two words for the page tag.&amp;nbsp;&amp;nbsp;fds_stat_t::words_used includes the page tag.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505657?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2024 07:26:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:315d9e60-9e89-453d-b7b9-3b6dfa31b387</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We delete bonds when the button is pressed on the board, as a factory reset. But the customers claim that bonds are deleted without having pressed the button. The mechanism is that after reset, we read the NRF_POWER-&amp;gt;RESETREAS register and if it is 0x01 then we know that a pin-reset occured, and therefore we delete bonds .&amp;nbsp;&lt;br /&gt;&lt;br /&gt;About pm_handler_flash_clean, do you think it is possible or safe, to change it and make it not delete the last peer (&amp;quot;Deletes the lowest ranked peer(s) when garbage collection is insufficient.&amp;quot;) but rather I delete records to free up space...&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Where can I find how much space the Peer Manager needs?&amp;nbsp;&lt;br /&gt;Here&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/lib_fds_functionality.html"&gt;https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/lib_fds_functionality.html&lt;/a&gt;, it says that peer manager uses 0xC000 file IDs and Record keys until 0xFFFF. But how much space does it really need?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Finally, in my application Flash size (project section placement)&amp;nbsp; is 0x5a000 ( = 368640) .&amp;nbsp;&lt;br /&gt;When I build it in Segger Embedded Studio, it says that 233,7 KB are used.&lt;br /&gt;On the other hand, nRF52832 has 512 kB, we use Softdevice (152 kB)&amp;nbsp;and bootloader (24 kB), and then the space left for the application is 336 kB.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In sdk_config.h, I have set 13 virtual pages (which peer manager also uses), and virtual page size is 2048 words. 1 page it says that is used by GC, so, I have available 2048 * 4 * 12 = 98304 bytes ?&amp;nbsp;&lt;br /&gt;I am a bit confused about the real space that is left for my data and the peer manager, in order to monitor the flash usage and free up space when needed.. Could you help me with this too?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much for your help&lt;/p&gt;
&lt;p&gt;Dimitra&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505652?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2024 06:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faad4062-d240-472f-bfb1-123d63b986b8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It depends on your implementation. Apart from calling pm_handler_flash_clean() in your pm event handler, do you have any other mechanisms for deleting bonds in your firmware? In the SDK examples, bonds are typically deleted if board button 1 is pressed at startup.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Auxiliary standard function for maintaining room in flash based on Peer Manager events.
 *
 * This function does the following:
 *  - Ranks peers by when they last connected.
 *  - Garbage collects the flash when needed.
 *  - Deletes the lowest ranked peer(s) when garbage collection is insufficient.
 *
 * @note See also @ref pm_handler_flash_clean_on_return.
 * @note In normal circumstances, this function should be called for every Peer Manager event.
 * @note This function is a supplement to @ref pm_handler_on_pm_evt, not its replacement.
 *
 * @param[in]  p_pm_evt  Peer Manager event to handle.
 */
void pm_handler_flash_clean(pm_evt_t const * p_pm_evt);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505611?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2024 14:49:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e1e002d-28bd-4aec-ab72-7d9e09e30805</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;Ok, so there is not any other reason why the bonds might be deleted? \the only way is that the peer manager deletes them and it does it when there is no enough space.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505606?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2024 14:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab289952-c281-490a-afdb-07850eb6e2cc</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Dimitra,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think the easiest solution may be to periodically monitor the flash usage with the fds_stat() function and perform GC or freeing of records before the FDS becomes full.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505604?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2024 14:17:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d22ac2d9-d81d-4c08-9b36-90ddf4a517e1</guid><dc:creator>DimitraN</dc:creator><description>&lt;p&gt;Yes we use FDS&amp;nbsp;to save application data in flash.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So, does this mean that&amp;nbsp;there is a way to configure the peer manager to never delete the only one bond of the device or I should keep track of the free memory, and stop saving data early enough before the flash is trully full, and then peer manager will not be forced to delete the last and only bond? How can I do this, or where can I find how much space peer manager needs so that it never deletes the bonds? Or is there another way to handle this situation in general?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;best regards,&lt;br /&gt;Dimitra&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reasons why bonds are deleted?</title><link>https://devzone.nordicsemi.com/thread/505560?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2024 12:20:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb4fe730-24d3-4805-be60-7b30eaeba7d6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;Dimitra,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The Peer Manager can be configured to delete the oldest bond to free up space in FDS for new bonds. This works fine as long as FDS is only used for storing bonding information. However, if FDS is also used for storing other application data, there is a possibility that the Peer Manager could be forced to delete the last and only bond. So, are you using FDS for storing other data in your application?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>