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

NRF52840 Using 15.3 SDK Internal Flash Write Issue when Device Config multiple Role.

HI.

I Want DFU In Application  So I Want to Write DFU Data In Internal Flash. Device configure  has total 3 links... 2 -Pheriphiral Link and 1 Central Link use in my project 

when i used only peripheral link Internal Flash Read Write Work ok but when I use Central with peripheral it's not work 

so please let me know which parameter needs to change and which macro needs to enable in my project.

Thanks

-Nikunj

  • Hello Nikunj,

     

    when i used only peripheral link Internal Flash Read Write Work ok but when I use Central with peripheral it's not work 

     Can you elaborate what part that didn't work? Does the log say anything?

  • Hello,

    Device Support 2 PeriphiraL AND 1 Central link when my device is in periphiral Internal Flash Read Write is ok ..im using same firmware Deivce In Central Mode at that time intenal flash is busy what is the reason please Suggest im using bleow Function.

                if(flash_write_timeout())
    			{
                     #ifdef DEBUG_BLE_NETWORK
                        uint8_t debug[50];
                        memset(debug, 0, sizeof(debug));
    					sprintf((char *)debug,"\r\n CASE A \r\n);      
                        DEBUG(debug);                
                    #endif	
                    
    				return 1;
    			}
    
    		  // Erase the target page
    		  ret_val = nrf_dfu_flash_erase(target_addr, 1, NULL);
    		  if (ret_val != NRF_SUCCESS)
    		  {
    			  #ifdef DEBUG_BLE_NETWORK
                        uint8_t debug[50];
                        memset(debug, 0, sizeof(debug));
                        sprintf((char *)debug,"\r\n ERASE ERROR:%X\r\n",ret_val);   
                        DEBUG(debug);                
                   #endif
    			return ret_val;
    		  }
                if(flash_write_timeout())
    			{
                    #ifdef DEBUG_BLE_NETWORK
                        uint8_t debug[50];
                        memset(debug, 0, sizeof(debug));
                        sprintf((char *)debug,"\r\n CASE B\r\n");
                        DEBUG(debug);                
                    #endif	
                    
    				return 1;
    			}
    
    
    //Flash Wait Timeout
    uint8_t flash_write_timeout(void)
    {      
        uint8_t lu8_count=0;       
    	while (nrf_fstorage_is_busy(NULL))
    	{
    		if(lu8_count++ > 100)
    		{
    			return(1);
    		}
            nrf_delay_ms(20);
    	}
    	return(0);
    }

    Allways When Deivce is in Central mode i got error Debug "CASE B" What is the reason Please suggest me.

    Thanks

    -Nikunj

  • Flash updates cannot run while the RADIO is running, so the SD schedules them in between radio events.

    If your connection and/or scanning parameters are too tight, there will not be enough room left for those flash events. In this case they can be delayed significantly.

    Workaround: Use looser connection intervals, and less "active" scanning time for central.

  • Hello,

    When Device is in Central mode First Disconnect Connection ,Stop scanning and Stop Advertisement after try to Erase Internal Flash at that time i got an error Flash is Busy.Even i increase flsah time out 2 sec to 5 sec got same error ,Please suggest what is the reson for that issue.

    Thanks

    -Nikunj 

  • Perhaps you can show how you disconnect, stop advertising and stop scanning before you try to write to flash?

    Another thing you can try is to increase the connection interval. Let me know if you are not sure how to do this. Please remember that it is the central that decides the connection interval. Also, increase the scan interval and advertising interval, but not the scan window.

    BR,

    Edvin

Related