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

DFU & IOS & Bonding

Hi guys,

in my application, I'm trying to do multiple fota, I succeed at the first time & after that I can jump again to the bootloader, but after that something is going wrong, bonds with bootloader are erased and I cannot connect to it again even it had finished the timeout and back again to the original firmware, I don't if someone face this problem before.

one more thing, I couldn't do multiple fota with IOS, I couldn't even jump to "dfutarg or bootloader" again because my new device is defined in the paired list & it's already connect to it through the settings, that's why I don't know how to jump again to the bootloader to do fota.

finally, for my final product, how can I avoid using "App_error_check". is there any standard method to do this or I have to do it my self.

kindly be noted that I'm using sdk12 and one of the examples called 'ANCS".

thanks.

  • How are you entering the bootloader ? Via a button on a GPIO pin, which is pressed during power cycling (or resetting)?

  • @RogerClark , I can't use buttons in my application, I'm entring the bootloader by enable notification on DFU packet control & send 0x01 on the same characteristic, before it disconnects immediately & start advertising as "dfutarg" but no it discconnects but take some time & advertise as dfutarg with erasing bonds and I can't connect to it or even my application again. if it's possible I would try on both IOS and android but it seems to be useless for IOS because once it's added to paired devices, I couldn't jump even to the bootloader.

  • @mohamed: How did you bond to the device (when the "Pair with this device?"pop up appear) ? You bond when you are in bootloader mode or you bond when you are in application mode (ANCS)?

    If you bond in application mode and you don't want to lose bond after you do DFU, you would need to define how much space you want to reserve for the bond information.

    If you are using the secure bootloader from SDK v12, you can have a look here

    You would need to match the APP_DATA_RESERVED size with the size of the fds (or pstorage) you used for peermanager/device manager. On SDK v12 it's 3 virtual page (3kB on nRF51 and 12kB on nRF52)

  • @HungBui yup, I'm pairing by this pop up notification to pair or cancel, then it's paired in application mode. okay I'm reading your link now & would see if it's applied in my code or not but I tried it before and it was working with me. I'm using the device manager and pstorage.

  • @hungbui here is my pstorage configuration:

    				static __INLINE uint16_t pstorage_flash_page_size()
    				{
    				  return (uint16_t)NRF_FICR->CODEPAGESIZE;
    				}
    				#define PSTORAGE_FLASH_PAGE_SIZE     pstorage_flash_page_size()      
    				#define PSTORAGE_FLASH_EMPTY_MASK    0xFFFFFFFF                     
    
    				#ifdef NRF51
    				#define BOOTLOADER_ADDRESS           (NRF_UICR->BOOTLOADERADDR)
    				#elif defined NRF52
    				#define BOOTLOADER_ADDRESS           (PSTORAGE_FLASH_EMPTY_MASK)
    				#endif
    
    				static __INLINE uint32_t pstorage_flash_page_end()
    				{
    				   uint32_t bootloader_addr = BOOTLOADER_ADDRESS;
    				  
    				   return ((bootloader_addr != PSTORAGE_FLASH_EMPTY_MASK) ?
    						   (bootloader_addr/ PSTORAGE_FLASH_PAGE_SIZE) : NRF_FICR->CODESIZE);
    				}
    
    				#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end()
    
    				#define PSTORAGE_NUM_OF_PAGES       2                                                          
    				#define PSTORAGE_MIN_BLOCK_SIZE     0x0010                                                     
    				#define PSTORAGE_DATA_START_ADDR    ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \
    													* PSTORAGE_FLASH_PAGE_SIZE)                                 
    				#define PSTORAGE_DATA_END_ADDR      ((PSTORAGE_FLASH_PAGE_END - 1) * PSTORAGE_FLASH_PAGE_SIZE)  
    				#define PSTORAGE_SWAP_ADDR          PSTORAGE_DATA_END_ADDR                                     
    				#define PSTORAGE_MAX_BLOCK_SIZE     PSTORAGE_FLASH_PAGE_SIZE                                    
    				#define PSTORAGE_CMD_QUEUE_SIZE     10
    
Related