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

Bootloader DFU stop advertising after updating new firmware

Hello,

I'm using this example of code (nRF5_SDK_11.0.0_89a8197\examples\dfu\bootloader\pca10040\dual_bank_ble_s132\arm5_no_packs) with my custom board  to perform a dfu. So in this it"s seems to support use of button but in my case there is no button on board so i disabled the below code:

//dfu_start |= ((nrf_gpio_pin_read(BOOTLOADER_BUTTON) == 0) ? true: false);

and all  related function thats use BOOTLOADER_BUTTON.

1. is the desactivation of the button code can run the app as if there was no button on board or there is another trick to enter the DFUmode without using the button. ? 

2. I have another issue ; i have downloaded an hex file over the air, the DFU work well , and bootloader give control to the application but stop advertinsing.as "DfuTrgt" si i can't perform another dfu . Do you have any idea where and how to change code  in order to perform dfu again even if application ?

Best regards

Parents
  • Hi Geek, 

    Yes, we have the buttonless example that can do exactly what you looking for. Read about it here and here. I have a note about it in my blog here as well. 

  • Hi Hung Bui,

    Actually i can perform with the example provideed in the sdk11, i have only  disable the use of button and it work as i expected. I would like to use sdk11 not sdk13 with the buttonless exemple. So im looking for solution with the use of sdk11 exemple. 

    I have already read your article about buttonless dfu but it doesn't fit actually my need. So, i look for solution of  why i can't perform more DFU and why my bootloader DFU stop adverttising once application start runing ?

  • I'm not familiar with DAP debugger, but as far as I know you should be able to set a breakpoint and step using GDB. As in this link .

    What you need to do is to add a breakpoint inside app_error_handler() and check what error and which line cause the issue. 

    I'm not sure how you build your application without debugging ability ? 

    It's strongly recommended to get hold of a nRF52 DK. You can use the DK as a Jlink debugger. 

    One question, why do you use SDK v11  ? The latest SDK is v15.3

  • Yes I Know that SDK15.3 is the latest version, but for my project needs i use SDK11 version.

    So, I have devlopped a Python application that integrate a dfu process and fit the dfu exmple project that you have provide in sdk11.

    The problem with this example is that they use Button to enter in DFU mode and for my project needs , the dfu should bye placed in Bootloader not in the Application that's why i look for an example of bootloader thats not need tu use button to enter in dfu mode.

  • Hi, 

    Please first make sure you have tested the buttonless example and you can do a DFU update without a button. 

    Then you can start integrate it into your application. Please make sure you have configured the memory properly. Increase the vs_uuid_count in the softdevice enable configuration, before calling softdevice_enable()

  • Hi Hung Bui,

    I Have not test the Buttonless example, I have creat  a Custom Service in My Application that trigger Bootloader to enter in DFU Mode . So I have added somme line in Bootloader main code to creat shared area where i place flag that  my app change when i wont to enter DFU Boot mode.

    		if (flag == 1) 
    		{			
    			dfu_start= true;
    			flag = 0;
    		}

    So, the problem is i can't get the flag change after soft rest . Can you please tell me the correct way to set the flag after boot to valid application.

    Kindly regards

  • Please tell exactly how you share the flag variable ? How do you switch from application to bootloader ?

    Note that RAM get reset when you trigger a soft reset . 

    You would need to either use retention register (GPREGRET) or use flash to store the data of the flag. 

Reply Children
  • Hi Hung Bui,

    I have added  share memory  flash adrress between bootloader and application.So its a simple way to force bootloader to  enter bootloader mode by  writing  "true" value in to this memory adress from the application and make a prompt test to the above "flag" variable.

    Now Im facing another issue, it's about power consumption. The software that's im use to send app image ,transmitt about 200 Byte every 1s and my app image is about 33KByte, So i spend more 3 min to download all the image. 

    During the download, Bootloader DFU draw 5mA every 1s, so for 3min I consume 900 mA. 

    My question is, there is any way to reduce power consumption ?

  • Usually we use a retention register instead of a shared RAM area but I think it would be fine. 

    200 byte per second is very low. I would assume that it's the limitation on the peer device, not because of the nRF52 ? 

    I'm not sure I understand what you meant by 5mA every 1s. Do you mean 5mAh  ? Current can't be measured over time.

    Or it's the constant 5mA current you are seeing ? 

    Are you using our unmodified bootloader ? 

  • Hi,

    thank you for replay. I have attached some screenshot to show current drawing in different phase bootloader runing.

    In this picture, bootloader continue to consume current even if is waiting for image packets (Here Peer device doesn't start sending image file).

     

    Here, peer device start sending packet

    and after finshed image downloding there is a current peak  consumption due to the transition from bootloader to the application

    i hope it a bit clear now. 

    "Are you using our unmodified bootloader ? "

    yes, i m using unmodified bootloader.

  • Hi, 

    The image doesn't show the current (it shows the voltage drop ? ) so I don't know what's the current is.

    When you mentioned " is waiting for image packet", is the connection established or not ? In both case, the bootloader will either advertise , or have to wake up to handle the connection (even though there is no data transfer) so it's normal to periodically have some peak current.

    The long period after the image transfer finish could be the period where the image is swapped the CPU has to be active to do flash operation. 

  • sorry , i missed to tell that i m using small resistor(100 ohm) in line with power supply (3,6 V). So the average current is  7,8 mA .

    "Is waiting for image packet" means that  the connection is not established yet . That's why im totally surprised that bootloader still consuming current even though there is no connection .

Related