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

Unable to initialize the FDS module

Hello,

I wanna use FDS module and started with FDS example given in SDK 11.

I have used the exactly same functions for initialization but it seems like FDS module is not getting initialized.

I have searched the forum and found some people facing the same problem but there fixes did not work for me. That is why I raised this question, may be I am missing something else.

Here is the sequence in which I am initializing my modules.

I am posting this because this post FDS Initialization Failed reports that the wrong initialization sequence may result into FDS initialization error but I have taken this into consideration but to no avail for my case.

// Initialize.
    timers_init();			//It calls APP_TIMER_INIT which should be called once
		buttons_leds_init(&erase_bonds);
		ble_stack_init();
		
   
		//Step2 in DB discovery ::  Initialize the db_discovery module with ble_db_discovery_init() in main().
		db_discovery_init();
		os_c_init();				//Our Service Init STH
		
		gap_params_init();
    conn_params_init();
		services_init();
		advertising_init();
    
		//device_manager_init(erase_bonds);
    peer_manager_init(erase_bonds);
		

		/****************		TEST FDS		*****************/
		
		err_code =fds_test_init();
		APP_ERROR_CHECK(err_code);
		while(fds_init_done==0);												//Waiting for initialization event for FDS
		

Here is the code for the "fds_test_init" which is same as in example.

static ret_code_t fds_test_init (void)
{
	
		ret_code_t ret = fds_register(my_fds_evt_handler);
		if (ret != FDS_SUCCESS)
		{
					return ret;
		}
		ret = fds_init();
		if (ret != FDS_SUCCESS)
		{
				return ret;
		}
		
		return NRF_SUCCESS;
		
}

Can anyone help me identify why my flag "fds_init_done" is never set to 1.

while I am setting it the FDS event handler as follows:

 switch (p_fds_evt->id)
    {
        case FDS_EVT_INIT:
            if (p_fds_evt->result != FDS_SUCCESS)
            {
                // Initialization failed.
            }
						else if (p_fds_evt->result == FDS_SUCCESS)
            {
                // Initialization succeeded
								fds_init_done=1;
            }
            break;

Your help will really be appreciated.

Thanks

Parents
  • FormerMember
    0 FormerMember

    Did you remember to add fs_sys_event_handler(..) to sys_evt_dispatch()?

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        // Dispatch the system event to the fstorage module, where it will be
        // dispatched to the Flash Data Storage (FDS) module.
        fs_sys_event_handler(sys_evt);
    
        // Dispatch to the Advertising module last, since it will check if there are any
        // pending flash operations in fstorage. Let fstorage process system events first,
        // so that it can report correctly to the Advertising module.
        ble_advertising_on_sys_evt(sys_evt);
    }
     // (SDK 12.3.0)

  • Dear Kristin,

    I guess, this is not the problem of registering the event handler.

    Because I have just checked that my app goes into the my_fds_evt_handler()

    BUT p_fds_evt->result != FDS_SUCCESS

    Please check the code below

    static void my_fds_evt_handler(fds_evt_t const * const p_fds_evt)
    {
        switch (p_fds_evt->id)
        {
            case FDS_EVT_INIT:
                if (p_fds_evt->result != FDS_SUCCESS)
                {
                    // Initialization failed.
                }
    						else if (p_fds_evt->result == FDS_SUCCESS)
                {
                    // Initialization succeeded
    								fds_init_done=1;
                }
                break;

Reply
  • Dear Kristin,

    I guess, this is not the problem of registering the event handler.

    Because I have just checked that my app goes into the my_fds_evt_handler()

    BUT p_fds_evt->result != FDS_SUCCESS

    Please check the code below

    static void my_fds_evt_handler(fds_evt_t const * const p_fds_evt)
    {
        switch (p_fds_evt->id)
        {
            case FDS_EVT_INIT:
                if (p_fds_evt->result != FDS_SUCCESS)
                {
                    // Initialization failed.
                }
    						else if (p_fds_evt->result == FDS_SUCCESS)
                {
                    // Initialization succeeded
    								fds_init_done=1;
                }
                break;

Children
No Data
Related