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

FDS_ERR_NO_SPACE_IN_FLASH

Hi!

SDK13, nRF52.

I try to use FDS storage to flash and always get FDS_ERR_NO_SPACE_IN_FLASH.

What shold I check for normal work?

Now I have next settings:

#define FDS_MAX_USERS 8

#define FDS_VIRTUAL_PAGES 3

#define FDS_VIRTUAL_PAGE_SIZE 1024

#define FSTORAGE_ENABLED 1

???

  •     #define ACCELL_LEV_PUSH_1_FLAG	        0x2241
        
        static bool fds_is_existed_record(fds_record_desc_t * record_desc, uint16_t key)
    {
    	fds_find_token_t    ftok ={0};
    	
    	return (fds_record_find(FILE_ID, key, record_desc, &ftok) == FDS_SUCCESS);
    }
    
    static ret_code_t fds_write(int32_t sens, uint16_t key)
    {
    		fds_record_t        record;
    		fds_record_desc_t   record_desc;
    		fds_record_chunk_t  record_chunk;
    	
    		static int32_t data;
    		data = sens;
    	
    		record_chunk.p_data         = &data;
    		record_chunk.length_words   = 1;
    		record.file_id              = FILE_ID;
    		record.key              		= key;
    		record.data.p_chunks       	= &record_chunk;
    		record.data.num_chunks   		= 1;
    
    		if(fds_is_existed_record(&record_desc, key))
    			return fds_record_update(&record_desc, &record);
    		else
    			return fds_record_write(&record_desc, &record);
    }
    
    main ()
    {
    ....
    ...
    ...
    ...
    	settings_init();
    	
        uint32_t err_code = fds_write(0x04, ACCELL_LEV_PUSH_1_FLAG); 
    		return err_code; // and in this I get error that no flash space
    }
    		
    		

  • Hey Mikhail,

    I need to see how you have initiated the FDS library. Do you mind sharing a stripped down version of your code, with just code that is relevant to the FDS.

    Cheers,

    Håkon.

  • static bool fds_is_existed_record(fds_record_desc_t * record_desc, uint16_t key)
    {
    	fds_find_token_t    ftok ={0};
    	
    	return (fds_record_find(FILE_ID, key, record_desc, &ftok) == FDS_SUCCESS);
    }
    
    static ret_code_t fds_write(int32_t sens, uint16_t key)
    {
    		fds_record_t        record;
    		fds_record_desc_t   record_desc;
    		fds_record_chunk_t  record_chunk;
    	
    		static int32_t data;
    		data = sens;
    	
    		record_chunk.p_data         = &data;
    		record_chunk.length_words   = 1;
    		record.file_id              = FILE_ID;
    		record.key              		= key;
    		record.data.p_chunks       	= &record_chunk;
    		record.data.num_chunks   		= 1;
    
    		if(fds_is_existed_record(&record_desc, key))
    			return fds_record_update(&record_desc, &record);
    		else
    			return fds_record_write(&record_desc, &record);
    }
    
    static ret_code_t fds_read(int32_t * sens, uint16_t key)
    {
    		fds_flash_record_t  flash_record;
    		fds_record_desc_t   record_desc;		
    		uint32_t 						err_code;
    		
    		while(fds_is_existed_record(&record_desc, key))
    		{
    				if((err_code = fds_record_open(&record_desc, &flash_record)) != FDS_SUCCESS)				
    					return err_code;						
    
    				* sens = * (int32_t *)flash_record.p_data;
    
    				return fds_record_close(&record_desc);			
    		}
    		return FDS_ERR_NOT_FOUND;		
    }
    
    uint32_t settings_set_sens(int32_t sens)
    {
    		uint32_t err_code = fds_write(sens, SENS_REC_KEY);
    		return err_code;
    }
    
    int32_t settings_get_sens(void)
    {
    		int32_t sens;	
    		uint32_t err_code = fds_read(&sens, SENS_REC_KEY);	
    		if(err_code != FDS_SUCCESS)
    			return DEFAULT_SENSITIVITY;
    		else
    			return sens;
    }
    
    static void settings_evt_handler(fds_evt_t const * const p_fds_evt)
    {
    		switch (p_fds_evt->id)
    		{
    			case FDS_EVT_WRITE:
    				if(p_fds_evt->result == FDS_SUCCESS)
    				{
    					__asm("nop");
    				}
    				break;
    			default:
    				break;
    		}
    }
    
    void settings_init(void)
    {		
    		APP_ERROR_CHECK(fds_register(settings_evt_handler));
    		APP_ERROR_CHECK(fds_init());
    }

    first call settings_init();

    may be due to bonded devices? I just want to bond 4 devices. Is it possible to increase size of memory? Because when I erase all bond devices and just bond 1 device- error code is OK (0x00).

  • Hey Martin,

    Try increasing the number of virtual pages. 

    I'm afraid I will not be able to help you any further with your problem until after the Easter holidays (04.02.18)

    Best regards,

    Håkon.

  • I had the same problem. It turned out I wasn't using garbage collector.

Related