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

ble_app_buttonless_dfu not advertising on nrf52811 after DFU process

Hello, i've tested dfu process from secure_bootloader with different app examples with success (ble_app_blinky, ble_app_uart, even a custom application) but, when I try the same with the ble_app_buttonless_dfu example, with no change in code (main.c), my device is not advertising.

I'm on SDK16.0.0 with a custom board with nrf52811 and i've configured the mcu to use low frequency SoftDevice clock source (RC) as I've read before here in the forum (which previously was a problem and solved bootloader not advertising).

It's working (the ble_app_buttonless_dfu example advertising after DFU over dfuTarg) on the nrf52 DK (nrf52832) with low freq clock configuration and s112 SoftDevice.

Thanks in advance.

Note: bootloader's enter_method_button is disabled.

Parents
  • Hi Santi, 

    Do you s112 v7.0.1 for nRF52811?  Could you provide the logs from the DFU master, and also the bootloader (RTT log from using _debug example bootloader project)? They are generally helpful. 

    If you have nRF52840 DK, you could test with pca10056e_s112_ble_debug. 
    -Amanda H.
  • Hi Amanda,

    Yes, softdevice is s112 v7.0.1, so i use --sd-req 0xCD for generating dfu packages.

    I do dfu over an android-phone's NrfConnect app so I don't know (I've never done this before) if show_log>DEBUG information is what you're asking for (file attached just for clarification).

    nRF Connect, 2021-04-14
    DfuTarg (D4:B5:30:40:71:E8)
    V	10:48:46.095	Connecting to D4:B5:30:40:71:E8...
    D	10:48:46.095	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	10:48:46.157	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	10:48:46.157	Connected to D4:B5:30:40:71:E8
    D	10:48:46.159	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    V	10:48:46.182	Discovering services...
    D	10:48:46.182	gatt.discoverServices()
    I	10:48:46.785	PHY updated (TX: LE 2M, RX: LE 2M)
    I	10:48:47.232	Connection parameters updated (interval: 15.0ms, latency: 0, timeout: 6000ms)
    D	10:48:47.283	[Callback] Services discovered with status: 0
    I	10:48:47.283	Services discovered
    V	10:48:47.301	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Secure DFU Service (0xFE59)
    - DFU Packet [WNR] (8ec90002-f315-4f60-9fb8-838830daea50)
    - DFU Control Point [N W] (8ec90001-f315-4f60-9fb8-838830daea50)
       Client Characteristic Configuration (0x2902)
    I	10:48:47.412	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    I	10:48:47.490	Connection parameters updated (interval: 15.0ms, latency: 0, timeout: 6000ms)
    D	10:50:29.598	[Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
    E	10:50:29.598	Error 8 (0x8): GATT CONN TIMEOUT
    I	10:50:29.598	Disconnected
    D	10:50:29.625	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    

    I have downloaded the _debug version of the bootloader and tried to "update" with an already generated package (only the app) but OTA doesn't start, is it because I have to generate package with --debug-mode flag or is it because I use a private_key?

    No, unfortunately I have not a nrf52840 DK, but i generate the nrf52811 versions of examples from all pca10056e versions deleting the two MACROs, <DEVELOP_IN_NRF52840> and <NRFX_COREDEP_DELAY_US_LOOP_CYCLES=3>.

    I download the bootloader to the nrf52811 through the SWD of the nrf52832 DK (PCA10040).

    Thank you so much.

  • Hi, 

    If you take a look at DFU Transport layer documentation, found here, you'll see that NRF_DFU_RES_CODE_INSUFFICIENT_RESOURCES means that there is not enough memory for the data object, i.e. the firmware image is too large. 

    What's the image size you are planning to update? Since there is 3*PAGE fds above the end address of app and the s112 is 96k(0x18000), the app is no more than 52k for nRF52811. See Memory layout  (the memory size of nRF52811 is the same as nRF52810) 

    -Amanda H.

  • Hi Amanda,

    Okay, but the app I'm trying to update (right now) is just the ble_app_buttonless_dfu example as-is (and it is the one that doesn't make OTA with debug bootloader and makes OTA but not advertise with normal bootloader).

    I'm very new to nRF development (started 2 months ago) and I don't know exactly how to know the size of an application, beyond seeing the .hex file size in the explorer, that in the case of ble_app_buttonless_dfu is 142kB, but it doesn't sound right cause the softdevice .hex file size is 276kB, not 96kB.

    Also, I've been trying to add dfu support to any other application example, in first place to ble_app_blinky, and I've done OTA of the app with secure_bootloader_debug on the nRF52811 with any problem, and after that, I've modified just the DEVICE_NAME and generate a new package and do OTA update using the application's DFU service with success. And the .hex file size of ble_app_blinky after DFU added is 66.4kB.

    The .hex file size of the final application that i was intended to add DFU support, in case the testing with the examples finished succesfully, is 50.2 kB right now.

    I'm just not understanding some things right now, sorry.

    Note: after some research I understand that the actual size of the ble_app_buttonless_dfu app may be the size of the .bin size included on the dfu package, being 51844bytes in this case. But i don't know how i'm goint to know the actual size (of another application) without generate a package.

    In case I didn't mention this before I'm using segger embedded studio for developing and building the app.

  • Hi Amanda,

    Maybe my last message was a little bit confussing, but I was waiting an answer.

    I'll try to simply:

    1) Did you mean that the ble_app_buttonless application "as is" is too big/heavy to programming on nRF52811? (i didn't understand why it does OTA on secure_bootloader (not emitting) but no _debug version, is it because of the bootloader' size?)

    2) Should I leave behind the ble_app_buttonless app and try to add OTA(DFU) to my 50kB(.hex)/19.85kB(.bin file inside dfu packet)

    Thank you too much

  • Hi Santi,

    Sorry for the delay. 

    Santi Dominguez said:
    but it doesn't sound right cause the softdevice .hex file size is 276kB, not 96kB.

     Here means the SoftDevice memory requirements in flash. You can check the s112_nrf52_7.0.1_release-notes.pdf under nRF5_SDK\components\softdevice\s112\doc.  The real require flash size is 100.0 kB (0x19000 bytes).

     

    Santi Dominguez said:
    The .hex file size of the final application that i was intended to add DFU support, in case the testing with the examples finished succesfully, is 50.2 kB right now.

     You can test with the nRF Connect Programmer app to see the flash size of the app. 

    Santi Dominguez said:
    Note: after some research I understand that the actual size of the ble_app_buttonless_dfu app may be the size of the .bin size included on the dfu package, being 51844bytes in this case. But i don't know how i'm goint to know the actual size (of another application) without generate a package.

     Check by the nRF Connect Programmer app.

    Santi Dominguez said:
    i didn't understand why it does OTA on secure_bootloader (not emitting) but no _debug version, is it because of the bootloader' size?

     Yes. You can diff the corresponding sdk_config.h files for a debug and non-debug bootloader project to see the difference. 

    Santi Dominguez said:
    2) Should I leave behind the ble_app_buttonless app and try to add OTA(DFU) to my 50kB(.hex)/19.85kB(.bin file inside dfu packet)

    It depends on the flash size of your application. 

    Have you tried ble_app_buttonless_dfu_s112 ? Can it work in your case?

    -Amanda H 

  • Hi Amanda,

    So, I go to nRF Connect Programmer and load my application (with dfu support added but not connectable) and it is two sections of 224 and 19622 bytes, being a total of 19846 bytes,so I understand the nrf52811 have plenty of size for it.

    So, I go to nRF Connect Programmer again but now I load the ble_app_buttonless_dfu app .hex file and it shows two sections of 92 and 51750 bytes, being a total of 51842 bytes, also < 60 kB nRF52810/11 limit seen on Memory Layout you pointed out.

    Okay, I just checked that in the nRF Connect Programmer Memory Layout the _debug version of bootloader overlaps the ble_app_buttonless_dfu region, cause _debug bootloader starts at 0x22000 and the app ends at 0x25A83, so I think that is the reason why the nRF52811 doesn't do OTA with _debug version of bootloader and it does with normal secure_bootloader.

    The flash size of _debug bootloader is 0xC000 and the limit on the MBR side is 0x2E000 so thats why the _debug starts at 0x22000 instead of 0x28000 (where normal bootloader does). So I guess _debug bootloader was never intended for use with ble_app_buttonless_dfu on nRF52810/11.

    Then, the maximum app flash size to use with _debug bootloader is 36kB?

    I still don't know why ble_app_buttonless_dfu app is not advertising afer DFU process on secure_bootloader, but I guess I will never know.

    Note: Whenever I say ble_app_buttonless_dfu I mean to say ble_app_buttonless_dfu_s112.

    Thank you so much.

Reply
  • Hi Amanda,

    So, I go to nRF Connect Programmer and load my application (with dfu support added but not connectable) and it is two sections of 224 and 19622 bytes, being a total of 19846 bytes,so I understand the nrf52811 have plenty of size for it.

    So, I go to nRF Connect Programmer again but now I load the ble_app_buttonless_dfu app .hex file and it shows two sections of 92 and 51750 bytes, being a total of 51842 bytes, also < 60 kB nRF52810/11 limit seen on Memory Layout you pointed out.

    Okay, I just checked that in the nRF Connect Programmer Memory Layout the _debug version of bootloader overlaps the ble_app_buttonless_dfu region, cause _debug bootloader starts at 0x22000 and the app ends at 0x25A83, so I think that is the reason why the nRF52811 doesn't do OTA with _debug version of bootloader and it does with normal secure_bootloader.

    The flash size of _debug bootloader is 0xC000 and the limit on the MBR side is 0x2E000 so thats why the _debug starts at 0x22000 instead of 0x28000 (where normal bootloader does). So I guess _debug bootloader was never intended for use with ble_app_buttonless_dfu on nRF52810/11.

    Then, the maximum app flash size to use with _debug bootloader is 36kB?

    I still don't know why ble_app_buttonless_dfu app is not advertising afer DFU process on secure_bootloader, but I guess I will never know.

    Note: Whenever I say ble_app_buttonless_dfu I mean to say ble_app_buttonless_dfu_s112.

    Thank you so much.

Children
  • Hi Santi, 

    Since the _debug bootloader uses about 48KB, that left about 36KB (0x019000-0x22000) for application to use. In that case, you can use a smaller app like ble_app_blinky.   

    Santi Dominguez said:
    I still don't know why ble_app_buttonless_dfu app is not advertising afer DFU process on secure_bootloader, but I guess I will never know.

    Secure_bootloader_ble_debug is too big to use with ble_app_buttonless_dfu. If you use secure_bootloader and ble_app_buttonless_dfu, it should work. May I know the flow and commands you are using?

    Because I don't have nRF52811DK, I use secure_bootloader_ble_s112_pca10056e and ble_app_buttonless_dfu_pca10056e_s112 to test and don't see any issue. 

    -Amanda H.

Related