<?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>Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81503/can-not-erase-flash-by-nrf_fstorage_sd-backend</link><description>I have a problom about using nrf_fstorage_erase won&amp;#39;t call nrf_fstorage_sys_evt_handler. 
 The project is on nrf52832 and using SDK 15.3, Softdevice s132 6.1.1. When I use nrf_fstorage_nvmc to be backend, everything is fine, but change backend to nrf_fstorage_sd</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Nov 2021 06:30:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81503/can-not-erase-flash-by-nrf_fstorage_sd-backend" /><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338684?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2021 06:30:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b074702-e23a-45a2-b76c-549e101c74b6</guid><dc:creator>Macrus_Li</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;I think I found the reason that why I can not erase the address after 0x73000 where my bootloader start at.&lt;/p&gt;
&lt;p&gt;The problem is in my own bootloader. Before jump into application, the bootloader will call nrf_bootloader_flash_protect&amp;nbsp;to protect the bootloader area, so when application wants to erase bootloader, it trigger the cpu hardfault and the erase was failed of course. &lt;br /&gt;And because using debug tool will let DISABLEINDEBUG register disable the protect, that&amp;#39;s also why &lt;br /&gt;I can erase the bootloader when using debug mode on application.&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;br /&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338489?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 08:23:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c808e4e-c437-474d-9dde-a68586a24bc3</guid><dc:creator>Macrus_Li</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;Thanks for your reply and the documented you provide.&lt;/p&gt;
&lt;p&gt;Now the API can erase flash include the bootloader, but it still a little bit weird. &lt;br /&gt;When I used debug mode to check any wrong with erase process, everything is fine,&lt;br /&gt;the API can erase all address in flash include bootloader address 0x73000.&lt;br /&gt;But when I just download the program by using keil, it seems like never erase, the bootloader still in flash.&lt;/p&gt;
&lt;p&gt;What&amp;#39;s different between debug mode and download program?&lt;br /&gt;should I check the any status before I erase?&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;br /&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338194?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 13:51:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6be6567e-83d2-46b4-adc9-9eb9d69804e6</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi Marcus,&lt;/p&gt;
&lt;p&gt;This should be documented here:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/mbr_bootloader/mbr_bootloader.html"&gt;https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/mbr_bootloader/mbr_bootloader.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338078?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 09:11:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0178929b-619f-4f26-b8b4-b53135221489</guid><dc:creator>Macrus_Li</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;My Bootloader is start at 0x73000.&lt;br /&gt;For some reason, I need to erase my bootloader and upgrade it, that why I asked how does softdevice know I have bootloader in it.&lt;br /&gt;And because the bootloader is build by my own, so it can not used DFU to upgrade it.&lt;/p&gt;
&lt;p&gt;Does there any way to pass or bypass the examine and let me can erase the bootloader?&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;br /&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338066?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 08:38:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:feb0eb66-f4e0-459f-a6e1-857dfc896cae</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi Marcus,&lt;/p&gt;
&lt;p&gt;Thanks for sharing the error.&lt;/p&gt;
&lt;p&gt;In terms of finding the end address, I suggest to do like FDS do it:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint32_t flash_end_addr(void)
{
    uint32_t const bootloader_addr = BOOTLOADER_ADDRESS;
    uint32_t const page_sz         = NRF_FICR-&amp;gt;CODEPAGESIZE;

#if defined(NRF52810_XXAA) || defined(NRF52811_XXAA)
    // Hardcode the number of flash pages, necessary for SoC emulation.
    // nRF52810 on nRF52832 and
    // nRF52811 on nRF52840
    uint32_t const code_sz = 48;
#else
   uint32_t const code_sz = NRF_FICR-&amp;gt;CODESIZE;
#endif

    uint32_t end_addr = (bootloader_addr != 0xFFFFFFFF) ? bootloader_addr : (code_sz * page_sz);

    return end_addr - (FDS_PHY_PAGES_RESERVED * FDS_PHY_PAGE_SIZE * sizeof(uint32_t));
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;BOOTLOADER_ADDRESS is defined in start of app_util.h as:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define BOOTLOADER_ADDRESS      ((*(uint32_t *)MBR_BOOTLOADER_ADDR) == 0xFFFFFFFF ? *MBR_UICR_BOOTLOADER_ADDR : *(uint32_t *)MBR_BOOTLOADER_ADDR) /**&amp;lt; The currently configured start address of the bootloader. If 0xFFFFFFFF, no bootloader start address is configured. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In case some pages are reserved by other modules, then FDS also have a reserved pages define:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define FDS_PHY_PAGES_RESERVED      ((FDS_VIRTUAL_PAGES_RESERVED * FDS_VIRTUAL_PAGE_SIZE) / FDS_PHY_PAGE_SIZE)&lt;/pre&gt;&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><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/338060?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 07:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97d51842-41a6-4a64-91c9-94c9a439f0d3</guid><dc:creator>Macrus_Li</dc:creator><description>&lt;p&gt;Hi Kenneth&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Sorry, it&amp;#39;s my fault.&lt;/p&gt;
&lt;p&gt;I test the example flash_fstorage with s132 and change the function nrf_fstorage_write to nrf_fstorage_erase, it works pretty good.So I compare all files include sdk_config.h, and I found that nRF_SoftDevice &amp;rarr; NRF_SDH_ENABLE &amp;rarr; Dispatch model &amp;rarr; NRF_SDH_DISPATCH_MODEL&amp;nbsp;need to be setting with NRF_SDH_DISPATCH_MODEL_INTERRUPT, not polling.&amp;nbsp;And finally it works.&lt;/p&gt;
&lt;p&gt;But I have another qusetion that when I erase the address after 0x73000, either example or my application are not work. Is it because I have bootloader on 0x73000?&lt;br /&gt;How can softdevice know I have a bootloader in it?&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;br /&gt;Marcus&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not erase flash by nrf_fstorage_sd backend</title><link>https://devzone.nordicsemi.com/thread/337939?ContentTypeID=1</link><pubDate>Mon, 08 Nov 2021 13:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c896a658-e4fc-4328-a023-8473cb6c4876</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Maybe it&amp;#39;s something wrong with registering the softdevice observer which should be handled in top of nrf_fstorage_sd.h:&lt;/p&gt;
&lt;p&gt;/* Define a nrf_sdh_soc event observer to receive SoftDevice system events. */&lt;br /&gt;NRF_SDH_SOC_OBSERVER(m_sys_obs, 0, nrf_fstorage_sys_evt_handler, NULL);&lt;/p&gt;
&lt;p&gt;Maybe you are missing nrf_sdh_soc.c?&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>