<?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 write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51399/fds-write-not-working-fds_err_not_initialized</link><description>Hi I am using the custom_bluetooth_service tutorial from https://github.com/bjornspockeli/custom_ble_service_example with SDK v15 and nrf52840 DK. 
 I am now trying to use fds to write data to flash storage and then access it later to assign the value</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 31 Aug 2019 00:04:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51399/fds-write-not-working-fds_err_not_initialized" /><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/207223?ContentTypeID=1</link><pubDate>Sat, 31 Aug 2019 00:04:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25d8bf66-8642-40e9-afc2-da91f2c1676a</guid><dc:creator>thoric_fish</dc:creator><description>&lt;p&gt;After moving the FDS related code outside of the BLE service, say to another function custom_fds(), would I still need a busy_wait between FDS init in pm_init and custom_fds()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/206774?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 08:06:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31cc9ce9-2d7d-4083-a3ed-849801bd7579</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see the problem now; as you indicated earlier, the initialization is asynchronous, and the completion is reported to the registered FDS callback(s). This takes a bit longer on initial boot because FDS need to &amp;quot;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_fds_format.html?cp=5_1_3_55_2_1#lib_fds_format_page"&gt;tag&lt;/a&gt;&amp;quot;&amp;nbsp;each of the allocated flash pages first. An easy solution to this is to&amp;nbsp;add a busy-wait delay between FDS init in pm_init and when you initialize the service.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A better solution maybe is to restructure the code so that FDS related code is placed outside of the BLE service.&amp;nbsp;Then you can more easily register the FDS users before fds_init().&amp;nbsp;ble_cus_custom_value_update() can be used to update the characteristic value once FDS is ready&lt;/p&gt;
&lt;p&gt;The address of a &amp;quot;uin8_t&amp;quot; variable is not guaranteed to be word-aligned so you should prefix the variable definitions with __ALIGN(4):&lt;/p&gt;
&lt;p&gt;__ALIGN(4) static uint8_t eight = 8;&lt;br /&gt;__ALIGN(4) static uint8_t nine = 9;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/206755?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 06:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b096722-1e47-4d2e-9e71-0ef4430c9b62</guid><dc:creator>thoric_fish</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I flashed the code you added, with some modifications that assigned the ret code of the fds write to the BLE custom characteristic. I attached the modified source and project files below. I am still getting a&amp;nbsp;FDS_ERR_NOT_INITIALIZED error after I flash the code to my NRF52840 DK. But when I turn the DK off then back on the error I get is FDS_ERR_UNALIGNED_ADDR. I am not sure why I am still getting these errors using the code you provided.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also tried writing to new FILE_ID and REC_KEY,&amp;nbsp;but I still get the same fds_write error. Do you have any suggestions on what else I should try to resolve these errors? Thanks!&lt;/p&gt;
&lt;h1 class="name"&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nordic_5F00_fds.zip"&gt;devzone.nordicsemi.com/.../nordic_5F00_fds.zip&lt;/a&gt;&lt;/h1&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/206545?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2019 09:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7531365-4c1e-4bee-beac-986b18a3dda0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think I would need the modified source files to replicate the exact same issue. Guess the code snippet you included includes most of the relevant code, but the part where the FDS user gets registered appears to be missing. Anyway, instead, I took the template example from SDK 15.3.0 and added main.c and the ble service from Bjørn&amp;#39;s git repo. Then moved the PM init before the service init and added the fds code.&lt;/p&gt;
&lt;p&gt;My test project:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-5c30ff16c8ef4ffb854e4fe2763c054b/ble_5F00_app_5F00_template.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_template.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/206427?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 14:45:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3517fdb4-145d-4133-8071-beecf1b2ab62</guid><dc:creator>thoric_fish</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_template_5F00_pca10056_5F00_s140.emProject.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_template_5F00_pca10056_5F00_s140.emProject.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I uploaded the compressed SES project file here, if it doesn&amp;#39;t open I can also provide just the c files I modified from the example code. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fds write not working FDS_ERR_NOT_INITIALIZED</title><link>https://devzone.nordicsemi.com/thread/206366?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:09:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1172a678-6c4d-4e57-8620-6e0cf6a52591</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you upload the whole project so I can try debugging it here? The &amp;quot;initialised&amp;quot; flag should be set to true if&amp;nbsp;&lt;span&gt;fds_init() returns FDS_SUCCESS so it&amp;#39;s strange that you later get this error when you write. I don&amp;#39;t think it&amp;#39;s related to the problem, but the documentation recommends to register all users first, then call fds_init().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&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></channel></rss>