This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Alternative to use sd_flash_page_erase using FDS

Hi there,

On my project I was working using sd_flash_xxx functions to write the whole flash pages or erase it, so I added peer manager to my project and I had to switch my functions from sd_flash_xxx to FDS, because I was getting hangs on my code when using sd_flash.

Are there a sd_flash_page_erase equivalent using FDS?

How can I select the address to write or erase using FDS functions?

and What is the max number of pages I can use? can I use 40 pages? I was using 40 writing/erasing about 40 flash pages using sd_flash_xxx functions.

Thanks

Arepa

Parents
  • Hi Hung, I still have problems after I added fstorage the event the fs_evt_handler doesn't triggered after call fs_store/fs_erase. I registered:

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        fs_sys_event_handler(sys_evt);
    }
    

    and I call inside my Fstorage initilialization:

    #define NUM_PAGES 1
    
    void fstorage_initialization(void)
    {
    	static uint32_t data;
    	uint32_t flash_data[4];
    	
    	FS_REGISTER_CFG(fs_config_t fs_config) =
    	{	
    	.p_start_addr = (uint32_t*)0x00060000,
        .p_end_addr = (uint32_t*)0x00061000,  			
        .callback = fs_evt_handler,
        .num_pages = NUM_PAGES,
        .priority = 0xFE  					
    	};
    		
    	fs_ret_t ret = fs_init();
    	if (ret != FS_SUCCESS)
    	{
    		NRF_LOG_INFO("fs_init() BSP_INDICATE_FATAL_ERROR \n\r");
    	}
    }		
    

    after initialized the peer manager

    I call fs_erase:

    uint32_t Page_erase(uint32_t page_address)
    {
    	FS_REGISTER_CFG(fs_config_t fs_config) =
    	{	
    		.p_start_addr = (uint32_t*)page_address ,
    		.p_end_addr = NULL, 			
    		.callback = fs_evt_handler,
    		.num_pages = NUM_PAGES,
    		.priority = 0xFE  					
    	};
    
    	fs_ret_t ret;
    	ret = fs_erase(&fs_config, fs_config.p_start_addr , 1, NULL);
    	APP_ERROR_CHECK(ret);
    	return ret;
    }
    

    my fstorage callback:

    static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result)
    {
    	if (result != FS_SUCCESS)
    	{
    		NRF_LOG_INFO("fs_evt_handlermand FATAL_ERROR \n\r");
    	}
    	else
    	{
    		NRF_LOG_INFO("    fstorage command successfully completed   \n\r");
    		fs_callback_flag = 0;
    	}
    }
    

    Are there any additional step in order to make work fstorage? my original project did not have fstorage or FDS

Reply
  • Hi Hung, I still have problems after I added fstorage the event the fs_evt_handler doesn't triggered after call fs_store/fs_erase. I registered:

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        fs_sys_event_handler(sys_evt);
    }
    

    and I call inside my Fstorage initilialization:

    #define NUM_PAGES 1
    
    void fstorage_initialization(void)
    {
    	static uint32_t data;
    	uint32_t flash_data[4];
    	
    	FS_REGISTER_CFG(fs_config_t fs_config) =
    	{	
    	.p_start_addr = (uint32_t*)0x00060000,
        .p_end_addr = (uint32_t*)0x00061000,  			
        .callback = fs_evt_handler,
        .num_pages = NUM_PAGES,
        .priority = 0xFE  					
    	};
    		
    	fs_ret_t ret = fs_init();
    	if (ret != FS_SUCCESS)
    	{
    		NRF_LOG_INFO("fs_init() BSP_INDICATE_FATAL_ERROR \n\r");
    	}
    }		
    

    after initialized the peer manager

    I call fs_erase:

    uint32_t Page_erase(uint32_t page_address)
    {
    	FS_REGISTER_CFG(fs_config_t fs_config) =
    	{	
    		.p_start_addr = (uint32_t*)page_address ,
    		.p_end_addr = NULL, 			
    		.callback = fs_evt_handler,
    		.num_pages = NUM_PAGES,
    		.priority = 0xFE  					
    	};
    
    	fs_ret_t ret;
    	ret = fs_erase(&fs_config, fs_config.p_start_addr , 1, NULL);
    	APP_ERROR_CHECK(ret);
    	return ret;
    }
    

    my fstorage callback:

    static void fs_evt_handler(fs_evt_t const * const evt, fs_ret_t result)
    {
    	if (result != FS_SUCCESS)
    	{
    		NRF_LOG_INFO("fs_evt_handlermand FATAL_ERROR \n\r");
    	}
    	else
    	{
    		NRF_LOG_INFO("    fstorage command successfully completed   \n\r");
    		fs_callback_flag = 0;
    	}
    }
    

    Are there any additional step in order to make work fstorage? my original project did not have fstorage or FDS

Children
No Data
Related