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

Problem with custom DFU Buttonless app (bootloader + settings + app .hex with bond_forwarding doesn't run)

Hello,

I'm developing an app for NRF52832 SDK 15.3, SD 132 6.1.1 with NUS service and Peer Manager with LESC JustWorks security and other FDS records. My app information is more extensively described here.

I want to use the DFU bootloader with the Buttonless Service and Characteristic. This is what I have tried so far, following this guide:

  1. Tested DFU Bootloader and Buttonless app with DK and nRF Connect for Android
  2. Customized Bootloader with own keys and for custom board. Advertistiment OK and custom LEDs.
  3. Generated signed .zip for my custom app and uploaded through DFU and nRF Connect for Android. Successfull.
  4. Merged DFU Buttonless example into my custom app for adding DFU Service
    1. Added adv_uuid for DFU service
    2. Added all functions from example and initialization
    3. Increased NRF_SDH_BLE_VS_UUID_COUNT to 2
    4. Updated RAM start according to debug information
  5. Uploaded my app through DFU and nRF Connect Android and app runs
    1. 00> <info> app: Setting vector table to bootloader: 0x00078000
      00> 
      00> <info> app: Setting vector table to main app: 0x00026000
      00> 
      00> <debug> app: FDS started.
      00> 
      00> <debug> app: Initializing fds...
      00> 
      00> <debug> app: Event: FDS_EVT_INIT received (FDS_SUCCESS)
      00> 
      00> <info> app: FDS Found 0 valid records.
      00> 
      00> <info> app: FDS Found 0 dirty records and 0 freeable words.
      00> 
      00> <info> app: FDS Writing config file...
      00> 
      00> <info> app: FDS Event data not found.
      
      CONNECT from ANDROID nRF Connect
      
      00> 
      00> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
      00> 
      00> <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
      00> 
      00> <info> app: Connected
      00> 
      00> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
      00> 
      00> <info> app: Data len is set to 0xF4(244)
      00> 
      00> <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7
      00> 
      00> <debug> nrf_ble_gatt: Data length updated to 123 on connection 0x0.
      00> 
      00> <debug> nrf_ble_gatt: max_rx_octets: 123
      00> 
      00> <debug> nrf_ble_gatt: max_tx_octets: 123
      00> 
      00> <debug> nrf_ble_gatt: max_rx_time: 1096
      00> 
      00> <debug> nrf_ble_gatt: max_tx_time: 1096
      00> 
      00> <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7
      00> <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7
      00> 
      00> <debug> nrf_ble_lesc: BLE_GAP_EVT_LESC_DHKEY_REQUEST
      00> 
      00> <info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
      00> 
      00> <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
      00> 
      00> <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
      00> 
      00> <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x0 bond=0x1 lv4: 0 kdist_own:0x3 kdist_peer:0x2
      00> 
      00> <debug> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
      00> 
      00> <debug> app: Record ID:  0x0002
      00> 
      00> <debug> app: File ID:  0xC000
      00> 
      00> <debug> app: Record key:  0xC007
      00> 
      00> <debug> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
      00> 
      00> <debug> app: Record ID:  0x0003
      00> 
      00> <debug> app: File ID:  0xC000
      00> 
      00> <debug> app: Record key:  0xC006
      00> 
      00> <debug> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
      00> 
      00> <debug> app: Record ID:  0x0004
      00> 
      00> <debug> app: File ID:  0xC000
      00> 
      00> <debug> app: Record key:  0xC008
      00> 
      00> <debug> app: Event: FDS_EVT_WRITE received (FDS_SUCCESS)
      00> 
      00> <debug> app: Record ID:  0x0005
      00> 
      00> <debug> app: File ID:  0xC000
      00> 
      00> <debug> app: Record key:  0xC009
      00> 
      00> <debug> app: Received data from BLE NUS. Writing data on UART.
    2. Issue #1: App seems to work but seems not to be stable. Sometimes NUS service doesn't seem to work (RTT doesn't show messages and I get no reply), other times it does, not all Debug data appears on RTT, on some ISR of my buttons, app seems to freeze. None of these happened before adding DFU. Anything I have to take care of? E.g. Flash zones for peer_manager and for custom data have to be moved? ISRs are now too long?
  6. If I try from nRF Connect to upload the same app again, it says:
    1. Initializing, Connecting, Starting Bootloader, and even Uploading...
    2. LEDs on board indicate that Bootloader has started and connected to nRF Connect...
    3. But after a while disconnects and App Starts again. I assume it is because my app is bonded and has security, so I try next point in the guide.
    4. 00> <info> app: Device is preparing to enter bootloader mode.
      00> 
      00> <debug> app: Disconnected connection handle 0
      00> 
      00> <info> app: Disconnected 1 links.
      00> 
      00> <debug> app: In ble_dfu_buttonless_bootloader_start_finalize
      00> 
      00> 
      00> 
      00> <info> app: Device will enter bootloader mode.
      00> 
      00> <info> app: Power management wants to reset to DFU mode.
      00> 
      00> <info> app: Power management allowed to reset to DFU mode.
      00> 
      00> <info> app: Setting vector table to bootloader: 0x00078000
      00> 
      00> <info> app: Setting vector table to main app: 0x00026000
      00> 
  7. I follow the guide steps Bond forwarding with buttonless DFU changing the sdk_config.h of bootloader and app
    1. flash the softdevice
    2. generate settings 
      Bootloader DFU Settings:
      * File:                     setting.hex
      * Family:                   nRF52
      * Start Address:            0x0007F000
      * CRC:                      0xDF50196E
      * Settings Version:         0x00000001 (1)
      * App Version:              0x00000001 (1)
      * Bootloader Version:       0x00000001 (1)
      * Bank Layout:              0x00000000
      * Current Bank:             0x00000000
      * Application Size:         0x00022CF8 (142584 bytes)
      * Application CRC:          0x27DC8B99
      * Bank0 Bank Code:          0x00000001
      * Softdevice Size:          0x00000000 (0 bytes)
      * Boot Validation CRC:      0x00000000
      * SD Boot Validation Type:  0x00000000 (0)
      * App Boot Validation Type: 0x00000000 (0)
    3. flash the bl + settings + app with nrfjprog 
      nrfjprog --family nRF52 --program APP_BL_ST.hex
      Parsing hex file.
      Reading flash area to program to guarantee it is erased.
      Checking that the area to write is not protected.
      Programing device.
    4. Issue #2: But no LEDs are blinking, the app doesn't start nor the bootloader, I see nothing on RTT viewer. No device is advertising.
    5. Also tried to flash every hex with nRF Connect Desktop (SD + BL + Settings + App). I get the same error that when I flash SD + DFU (see attached log) but this time doesn't work neither 2020-05-04T12_38_04.395Z-log.txt

What can I do for fixing these issues?

What could be the problem for Issue 2, something in the bootloader with the sdk_config changes, or in the app? Or with the merged files?

Thanks in advance and regards,

Bruno Santamaria

Parents
  • Update: Actually at point 6 of the post above, I'm not sure why device doesn't reset into DFU. DFU Bootloader has a different address so it should be a different device and could be connected by my phone regardless of the secure bond of my app. So the problem may start there.

    I don't need the DFU link to be secure as long as my app is bonded with security with my phone.

    2nd Update: In my previous post I found out that there was some problem with my android device, so I tried to repeat point 6 with nRF Connect for Desktop and my Development Kit. This time it worked: Flash SD and DFU, upload App, reupload App with buttonless feature.

    However the problem with my app persists. It doesn't answer to my NUS commands sometimes, not all debug messages appear on RTT, etc. See Issue #1 on my original post.

Reply
  • Update: Actually at point 6 of the post above, I'm not sure why device doesn't reset into DFU. DFU Bootloader has a different address so it should be a different device and could be connected by my phone regardless of the secure bond of my app. So the problem may start there.

    I don't need the DFU link to be secure as long as my app is bonded with security with my phone.

    2nd Update: In my previous post I found out that there was some problem with my android device, so I tried to repeat point 6 with nRF Connect for Desktop and my Development Kit. This time it worked: Flash SD and DFU, upload App, reupload App with buttonless feature.

    However the problem with my app persists. It doesn't answer to my NUS commands sometimes, not all debug messages appear on RTT, etc. See Issue #1 on my original post.

Children
No Data
Related