<?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>fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47324/fstorage-read-a-int-or-float-from-flash</link><description>Goodday 
 
 I have integrated the fstorage peripheral example with the BLE_beaconing example. SDK 15.2. I can read and write strings. I cannot read back the hex number if declared as an int or a float 
 my problem lies in how to use this function to read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 May 2019 14:43:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47324/fstorage-read-a-int-or-float-from-flash" /><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/189685?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 14:43:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:636befff-47eb-43e0-b021-4eee97ce14a7</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Thank you very much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/189665?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 13:39:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79497ac2-fbd2-4af0-ac6e-1f371a113f84</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct
{
    uint32_t data_uint32;                                  
    float  data_float;                              
    char string[12];
} my_data;

my_data m_my_data;
my_data m_my_data_readback;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    memset(&amp;amp;m_my_data, 0, sizeof(m_my_data));
    memset(&amp;amp;m_my_data_readback, 0, sizeof(m_my_data_readback));
    
    m_my_data.data_uint32 = 123;
    m_my_data.data_float = 456.789;    
    memcpy(m_my_data.string, m_hello_world_read, sizeof(m_my_data.string)-1);  
    
    NRF_LOG_INFO(&amp;quot;Writing &amp;quot; NRF_LOG_FLOAT_MARKER &amp;quot; to flash.&amp;quot;, NRF_LOG_FLOAT(m_my_data.data_float));
    rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3e300, &amp;amp;m_my_data, sizeof(m_my_data), NULL);
    APP_ERROR_CHECK(rc);

    wait_for_flash_ready(&amp;amp;fstorage);
    NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);

    rc = nrf_fstorage_read(&amp;amp;fstorage, 0x3e300, &amp;amp;m_my_data_readback, sizeof(m_my_data_readback));
    APP_ERROR_CHECK(rc);
    NRF_LOG_INFO(&amp;quot;Reading &amp;quot; NRF_LOG_FLOAT_MARKER &amp;quot; from flash.&amp;quot;, NRF_LOG_FLOAT(m_my_data_readback.data_float));

    wait_for_flash_ready(&amp;amp;fstorage);
    NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;NRF_LOG is not very fond of float values, but the above seems to work. The above example will store both an uint32, float, and a string, but for the purpose of the example only output the float value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/189366?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 14:02:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f048001d-3e86-444f-b310-51ff2d5bed58</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;thanks but it does&amp;nbsp;do anything&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;what should I add in the 3rd argument in the function&amp;nbsp; namely size ?&amp;nbsp;&lt;span&gt;&amp;amp;m_data_read,sizeof(m_data_read));&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/189355?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 13:33:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f37891f3-f8a6-45bc-a1cb-e398c8849a7c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;&amp;#39;const&amp;#39; typically means the variable is fixed (read-only) and thereby&amp;nbsp;cannot be updated.&amp;nbsp;I suggest to remove the const for any variable you want to be able to update run-time.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/how-to-modify-a-const-variable-in-c/"&gt;https://www.geeksforgeeks.org/how-to-modify-a-const-variable-in-c/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/189274?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 10:59:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4d73e0a-8f46-433e-b031-c61894da573f</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;I can confirm it is written correctly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;.&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/cafecafe.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Segger is showing a warrning as follow on the following read function&lt;/p&gt;
&lt;p&gt;rc = nrf_fstorage_read(&amp;amp;fstorage, 0x90000, &amp;amp;m_data_read,sizeof(m_data_read));&lt;/p&gt;
&lt;p&gt;warning : argument 3 of &amp;#39;nrf_fstorage_read&amp;#39; discards &amp;#39;const&amp;#39; qualifier from pointer target type [-Wdiscarded-qualifiers]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/187841?ContentTypeID=1</link><pubDate>Mon, 20 May 2019 09:25:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a794e0d-4932-487b-b939-e1e62aa24152</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Have you first made sure it&amp;#39;s stored as expected by calling:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrfjprog&amp;nbsp; --memrd 0x3E100 --n 100&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/187630?ContentTypeID=1</link><pubDate>Fri, 17 May 2019 07:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3525e561-c3d8-4ffa-b9f4-598d297f62de</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Kenneth let me rephrase the question&lt;/p&gt;
&lt;p&gt;In the fbelow peripheral example in SDK15.2. How do I read the value&amp;nbsp;BADC0FEE&lt;/p&gt;
&lt;p&gt;I can sucessfully read &amp;quot;hello word&amp;quot; using&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;rc = nrf_fstorage_read(&amp;amp;fstorage, 0x3e100, &amp;amp;m_data_read,sizeof(m_data_read));&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

/** @file
 *
 * @brief fstorage example main file.
 *
 * This example showcases fstorage usage.
 */

#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_soc.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;app_util.h&amp;quot;
#include &amp;quot;nrf_fstorage.h&amp;quot;

#ifdef SOFTDEVICE_PRESENT
#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
#include &amp;quot;nrf_fstorage_sd.h&amp;quot;
#else
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;nrf_fstorage_nvmc.h&amp;quot;
#endif

#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;


#define BUTTON_DETECTION_DELAY  APP_TIMER_TICKS(50)
#define APP_BLE_CONN_CFG_TAG    1


/* Defined in cli.c */
extern void cli_init(void);
extern void cli_start(void);
extern void cli_process(void);

static void fstorage_evt_handler(nrf_fstorage_evt_t * p_evt);


NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
{
    /* Set a handler for fstorage events. */
    .evt_handler = fstorage_evt_handler,

    /* These below are the boundaries of the flash space assigned to this instance of fstorage.
     * You must set these manually, even at runtime, before nrf_fstorage_init() is called.
     * The function nrf5_flash_end_addr_get() can be used to retrieve the last address on the
     * last page of flash available to write data. */
    .start_addr = 0x3e000,
    .end_addr   = 0x3ffff,
};

/* Dummy data to write to flash. */
static uint32_t m_data          = 0xBADC0FFE;
static char     m_hello_world[] = &amp;quot;hello world&amp;quot;;


/**@brief   Helper function to obtain the last address on the last page of the on-chip flash that
 *          can be used to write user data.
 */
static uint32_t nrf5_flash_end_addr_get()
{
    uint32_t const bootloader_addr = NRF_UICR-&amp;gt;NRFFW[0];
    uint32_t const page_sz         = NRF_FICR-&amp;gt;CODEPAGESIZE;
    uint32_t const code_sz         = NRF_FICR-&amp;gt;CODESIZE;

    return (bootloader_addr != 0xFFFFFFFF ?
            bootloader_addr : (code_sz * page_sz));
}


#ifdef SOFTDEVICE_PRESENT
/**@brief   Function for initializing the SoftDevice and enabling the BLE stack. */
static void ble_stack_init(void)
{
    ret_code_t rc;
    uint32_t   ram_start;

    /* Enable the SoftDevice. */
    rc = nrf_sdh_enable_request();
    APP_ERROR_CHECK(rc);

    rc = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(rc);

    rc = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(rc);
}
#else
static void clock_init(void)
{
    /* Initialize the clock. */
    ret_code_t rc = nrf_drv_clock_init();
    APP_ERROR_CHECK(rc);

    nrf_drv_clock_lfclk_request(NULL);

    // Wait for the clock to be ready.
    while (!nrf_clock_lf_is_running()) {;}
}
#endif


/**@brief   Initialize the timer. */
static void timer_init(void)
{
    ret_code_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
}


/**@brief   Sleep until an event is received. */
static void power_manage(void)
{
#ifdef SOFTDEVICE_PRESENT
    (void) sd_app_evt_wait();
#else
    __WFE();
#endif
}


static void fstorage_evt_handler(nrf_fstorage_evt_t * p_evt)
{
    if (p_evt-&amp;gt;result != NRF_SUCCESS)
    {
        NRF_LOG_INFO(&amp;quot;--&amp;gt; Event received: ERROR while executing an fstorage operation.&amp;quot;);
        return;
    }

    switch (p_evt-&amp;gt;id)
    {
        case NRF_FSTORAGE_EVT_WRITE_RESULT:
        {
            NRF_LOG_INFO(&amp;quot;--&amp;gt; Event received: wrote %d bytes at address 0x%x.&amp;quot;,
                         p_evt-&amp;gt;len, p_evt-&amp;gt;addr);
        } break;

        case NRF_FSTORAGE_EVT_ERASE_RESULT:
        {
            NRF_LOG_INFO(&amp;quot;--&amp;gt; Event received: erased %d page from address 0x%x.&amp;quot;,
                         p_evt-&amp;gt;len, p_evt-&amp;gt;addr);
        } break;

        default:
            break;
    }
}


static void print_flash_info(nrf_fstorage_t * p_fstorage)
{
    NRF_LOG_INFO(&amp;quot;========| flash info |========&amp;quot;);
    NRF_LOG_INFO(&amp;quot;erase unit: \t%d bytes&amp;quot;,      p_fstorage-&amp;gt;p_flash_info-&amp;gt;erase_unit);
    NRF_LOG_INFO(&amp;quot;program unit: \t%d bytes&amp;quot;,    p_fstorage-&amp;gt;p_flash_info-&amp;gt;program_unit);
    NRF_LOG_INFO(&amp;quot;==============================&amp;quot;);
}


void wait_for_flash_ready(nrf_fstorage_t const * p_fstorage)
{
    /* While fstorage is busy, sleep and wait for an event. */
    while (nrf_fstorage_is_busy(p_fstorage))
    {
        power_manage();
    }
}


static void log_init(void)
{
    ret_code_t rc = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(rc);
}


int main(void)
{
    ret_code_t rc;

#ifndef SOFTDEVICE_PRESENT
    clock_init();
#endif

    timer_init();
    log_init();
    cli_init();

    NRF_LOG_INFO(&amp;quot;fstorage example started.&amp;quot;);

    nrf_fstorage_api_t * p_fs_api;

#ifdef SOFTDEVICE_PRESENT
    NRF_LOG_INFO(&amp;quot;SoftDevice is present.&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Initializing nrf_fstorage_sd implementation...&amp;quot;);
    /* Initialize an fstorage instance using the nrf_fstorage_sd backend.
     * nrf_fstorage_sd uses the SoftDevice to write to flash. This implementation can safely be
     * used whenever there is a SoftDevice, regardless of its status (enabled/disabled). */
    p_fs_api = &amp;amp;nrf_fstorage_sd;
#else
    NRF_LOG_INFO(&amp;quot;SoftDevice not present.&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Initializing nrf_fstorage_nvmc implementation...&amp;quot;);
    /* Initialize an fstorage instance using the nrf_fstorage_nvmc backend.
     * nrf_fstorage_nvmc uses the NVMC peripheral. This implementation can be used when the
     * SoftDevice is disabled or not present.
     *
     * Using this implementation when the SoftDevice is enabled results in a hardfault. */
    p_fs_api = &amp;amp;nrf_fstorage_nvmc;
#endif

    rc = nrf_fstorage_init(&amp;amp;fstorage, p_fs_api, NULL);
    APP_ERROR_CHECK(rc);

    print_flash_info(&amp;amp;fstorage);

    /* It is possible to set the start and end addresses of an fstorage instance at runtime.
     * They can be set multiple times, should it be needed. The helper function below can
     * be used to determine the last address on the last page of flash memory available to
     * store data. */
    (void) nrf5_flash_end_addr_get();

    /* Let&amp;#39;s write to flash. */
    NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%x\&amp;quot; to flash.&amp;quot;, m_data);
    rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3e000, &amp;amp;m_data, sizeof(m_data), NULL);
    APP_ERROR_CHECK(rc);

    wait_for_flash_ready(&amp;amp;fstorage);
    NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);

#ifdef SOFTDEVICE_PRESENT
    /* Enable the SoftDevice and the BLE stack. */
    NRF_LOG_INFO(&amp;quot;Enabling the SoftDevice.&amp;quot;);
    ble_stack_init();

    m_data = 0xDEADBEEF;

    NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%x\&amp;quot; to flash.&amp;quot;, m_data);
    rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3e100, &amp;amp;m_data, sizeof(m_data), NULL);
    APP_ERROR_CHECK(rc);

    wait_for_flash_ready(&amp;amp;fstorage);
    NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);
#endif

    NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%s\&amp;quot; to flash.&amp;quot;, m_hello_world);
    rc = nrf_fstorage_write(&amp;amp;fstorage, 0x3f000, m_hello_world, sizeof(m_hello_world), NULL);
    APP_ERROR_CHECK(rc);

    wait_for_flash_ready(&amp;amp;fstorage);
    NRF_LOG_INFO(&amp;quot;Done.&amp;quot;);

    NRF_LOG_INFO(&amp;quot;Use &amp;#39;read&amp;#39; to read bytes from the flash.&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Use &amp;#39;write&amp;#39; to write bytes to the flash.&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Use &amp;#39;erase&amp;#39; to erase flash pages.&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Use &amp;#39;flasharea&amp;#39; to print and configure the flash read boundaries.&amp;quot;);

    cli_start();

    /* Enter main loop. */
    for (;;)
    {
        if (!NRF_LOG_PROCESS())
        {
            power_manage();
        }
        cli_process();
    }
}


/**
 * @}
 */
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/187530?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 12:30:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f077263-24a4-45fd-a282-f1e90b31fc09</guid><dc:creator>melt</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;1. I have removed the const still the same&lt;/p&gt;
&lt;p&gt;2. I have not erased it, im following the example and they dont mention anything&amp;nbsp;on erasing the flash under the peripheral fstorage&amp;nbsp; example, also the &amp;quot;Hello world&amp;quot; read and writes works 100% so why would I not be able to read the hex value.&lt;/p&gt;
&lt;p&gt;3.correct thanks I have changed it to %x&lt;/p&gt;
&lt;p&gt;my problem is&amp;nbsp;&amp;nbsp; rc = nrf_fstorage_read(&amp;amp;fstorage, 0x3f000, m_data_read, sizeof(m_data_read)); has a 3rd argument. when im reading just a hex byte what do I put as length - 1?&lt;/p&gt;
&lt;p&gt;im looking at the below lib explanation of the various functions&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__fstorage.html&amp;amp;anchor=gaebb4176a9aa38b3398e446efa0592939"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__nrf__fstorage.html&amp;amp;anchor=gaebb4176a9aa38b3398e446efa0592939&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;should I not use a pointer to that hex value in flash and dereference it?&lt;/p&gt;
&lt;p&gt;&amp;nbsp; m_data_pointer = *nrf_fstorage_rmap(&amp;amp;fstorage, 0x3e100);&lt;/p&gt;
&lt;p&gt;I dont think im using the right function to read a hex value.&lt;/p&gt;
&lt;p&gt;thanks for the help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fstorage read a int or float from flash</title><link>https://devzone.nordicsemi.com/thread/187525?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 11:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2adfa1bc-530d-4336-8c97-a1e47fe2ce90</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Haven&amp;#39;t tested the code, but a few things to try:&lt;/p&gt;
&lt;p&gt;1. I notice you have declared m_data_read as const, not sure if that will work here.&lt;/p&gt;
&lt;p&gt;2. I assume you have first erased the flash page, so the memory&amp;nbsp;0x3e100 is all FFF..&lt;/p&gt;
&lt;p&gt;3. Shouldn&amp;#39;t it be with an &amp;#39;x&amp;#39; in NRF_LOG_INFO(&amp;quot;Writing \&amp;quot;%x\&amp;quot; to flash.&amp;quot;, m_data_read); not &amp;#39;s&amp;#39;.&lt;/p&gt;
&lt;p&gt;Anyways, you may need to look into how to cast the data to the correct format it was stored in this thread:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47093/can-i-store-a-struct-in-eeprom-using-nordic-spi-api-and-sent-struct-through-nordic-ble-api"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/47093/can-i-store-a-struct-in-eeprom-using-nordic-spi-api-and-sent-struct-through-nordic-ble-api&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>