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

Immediate disconnect in DFU mode / Error 133 0x85

Hi all

I want to do a device firmware update via the bootloader, and I am unable to do so, as all attempts end with a disconnect from my Android phone (Pixel 4a). I can scan for the device, but when I try to use nRF Connect or nRF Toolbox, it either just times out and nothing happens or I get an attempt of an upload which takes around 30 seconds and then ends with "GATT error".

I am using the secure bootloader for SD s132 on SDK 17.0.2 and changed some things there using the CMSIS Configuration Wizard, e.g. advertising name and pin to my button. Everything runs on an nRF52832 on a custom board I designed. The application works as intended, it is just an issue with the DFU.

To troubleshoot the problem, I ran the debug version of the bootloader and got the following output:

00:00:00.000,000] <info> app: Inside main
[00:00:00.000,000] <debug> app: In nrf_bootloader_init
[00:00:00.000,000] <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
[00:00:00.000,000] <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
[00:00:00.000,000] <debug> nrf_dfu_settings: Using settings page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
[00:00:00.000,000] <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
[00:00:00.000,000] <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
[00:00:00.000,000] <debug> app: Enter nrf_bootloader_fw_activate
[00:00:00.000,000] <info> app: No firmware to activate.
[00:00:00.000,000] <debug> app: App is valid
[00:00:00.000,000] <debug> app: DFU mode requested via button.
[00:00:00.000,000] <info> nrf_bootloader_wdt: WDT is not enabled
[00:00:00.000,000] <debug> app: in weak nrf_dfu_init_user
[00:00:00.000,000] <debug> app: timer_stop (0x20005984)
[00:00:00.000,000] <debug> app: timer_activate (0x20005984)
[00:00:00.000,000] <info> app: Entering DFU mode.
[00:00:00.000,000] <debug> app: Initializing transports (found: 1)
[00:00:00.000,000] <debug> nrf_dfu_ble: Initializing BLE DFU transport
[00:00:00.000,000] <debug> nrf_dfu_ble: Setting up vector table: 0x00071000
[00:00:00.000,000] <debug> nrf_dfu_ble: Enabling SoftDevice.
[00:00:00.000,000] <debug> nrf_dfu_ble: Configuring BLE stack.
[00:00:00.000,000] <debug> nrf_dfu_ble: Enabling the BLE stack.
[00:00:00.000,000] <debug> nrf_dfu_ble: No advertising name found
[00:00:00.000,000] <debug> nrf_dfu_ble: Using default advertising name
[00:00:00.000,000] <debug> nrf_dfu_ble: Advertising...
[00:00:00.000,000] <debug> nrf_dfu_ble: BLE DFU transport initialized.
[00:00:00.000,000] <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
[00:00:00.000,000] <debug> app: Enter main loop
[00:00:00.000,000] <debug> nrf_dfu_ble: Connected
[00:00:00.000,000] <debug> nrf_dfu_ble: Advertising...
[00:00:00.000,000] <debug> nrf_dfu_settings: Using settings page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
[00:00:00.000,000] <debug> nrf_dfu_ble: Connected
[00:00:00.000,000] <debug> nrf_dfu_ble: Advertising...
[00:00:00.000,000] <debug> nrf_dfu_settings: Using settings page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
[00:00:00.000,000] <debug> nrf_dfu_ble: Connected
[00:00:00.000,000] <debug> nrf_dfu_ble: Advertising...
[00:00:00.000,000] <debug> nrf_dfu_settings: Using settings page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
[00:00:00.000,000] <debug> nrf_dfu_ble: Connected
[00:00:00.000,000] <debug> nrf_dfu_ble: Advertising...
[00:00:00.000,000] <debug> nrf_dfu_settings: Using settings page.
[00:00:00.000,000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.

Following that, I also installed Wireshark and ran a trace:

5246	98.249	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	299µs				0	ADV_IND
5247	98.249	5b:64:ce:90:3b:10	LE 1M	LE LL	12	150µs				0	SCAN_REQ
5248	98.249	ff:1c:eb:33:1d:d8	LE 1M	LE LL	6	149µs				0	SCAN_RSP
5249	100.324	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	2074537µs				0	ADV_IND
5250	100.325	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	497µs				0	ADV_IND
5251	100.325	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	497µs				0	ADV_IND
5252	103.066	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	2739598µs				0	ADV_IND
5253	103.066	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	497µs				0	ADV_IND
5254	103.067	5b:64:ce:90:3b:10	LE 1M	LE LL	34	150µs				0	CONNECT_IND
5255	103.091	Master_0xb02608b7	LE 1M	LE LL	9	23701µs	0	0	False	0	Control Opcode: LL_FEATURE_REQ
5256	103.136	Master_0xb02608b7	LE 1M	LE LL	9	44849µs	0	0	False	1	Control Opcode: LL_FEATURE_REQ
5257	103.180	Master_0xb02608b7	LE 1M	LE LL	9	44848µs	0	0	False	2	Control Opcode: LL_FEATURE_REQ
5258	103.225	Master_0xb02608b7	LE 1M	LE LL	9	44849µs	0	0	False	3	Control Opcode: LL_FEATURE_REQ
5259	103.270	Master_0xb02608b7	LE 1M	LE LL	9	44849µs	0	0	False	4	Control Opcode: LL_FEATURE_REQ
5260	103.315	Master_0xb02608b7	LE 1M	LE LL	9	44848µs	0	0	False	5	Control Opcode: LL_FEATURE_REQ
5261	124.112	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	20796277µs				0	ADV_IND
5262	124.113	5b:64:ce:90:3b:10	LE 1M	LE LL	34	150µs				0	CONNECT_IND
5263	124.151	Master_0x69a574da	LE 1M	LE LL	9	38072µs	0	0	False	0	Control Opcode: LL_FEATURE_REQ
5264	124.196	Master_0x69a574da	LE 1M	LE LL	9	44849µs	0	0	False	1	Control Opcode: LL_FEATURE_REQ
5265	124.241	Master_0x69a574da	LE 1M	LE LL	9	44848µs	0	0	False	2	Control Opcode: LL_FEATURE_REQ
5266	124.285	Master_0x69a574da	LE 1M	LE LL	9	44849µs	0	0	False	3	Control Opcode: LL_FEATURE_REQ
5267	124.330	Master_0x69a574da	LE 1M	LE LL	9	44849µs	0	0	False	4	Control Opcode: LL_FEATURE_REQ
5268	124.375	Master_0x69a574da	LE 1M	LE LL	9	44848µs	0	0	False	5	Control Opcode: LL_FEATURE_REQ
5269	144.099	ff:1c:eb:33:1d:d8	LE 1M	LE LL	23	19723913µs				0	ADV_IND
5270	144.100	5b:64:ce:90:3b:10	LE 1M	LE LL	34	150µs				0	CONNECT_IND
5271	144.130	Master_0xbdd8eb46	LE 1M	LE LL	9	30421µs	0	0	False	0	Control Opcode: LL_FEATURE_REQ
5272	144.176	Master_0xbdd8eb46	LE 1M	LE LL	9	44849µs	0	0	False	1	Control Opcode: LL_FEATURE_REQ
5273	144.221	Master_0xbdd8eb46	LE 1M	LE LL	9	44849µs	0	0	False	2	Control Opcode: LL_FEATURE_REQ
5274	144.266	Master_0xbdd8eb46	LE 1M	LE LL	9	44848µs	0	0	False	3	Control Opcode: LL_FEATURE_REQ
5275	144.311	Master_0xbdd8eb46	LE 1M	LE LL	9	44849µs	0	0	False	4	Control Opcode: LL_FEATURE_REQ
5276	144.355	Master_0xbdd8eb46	LE 1M	LE LL	9	44849µs	0	0	False	5	Control Opcode: LL_FEATURE_REQ

To me, there is nothing obvious here. The only error code I got was in the nRF Connect app, the aforementioned Error 133 / 0x85.

I did find some hints that the address might change when connecting to DFU and that confuses the nRF Connect on Android somehow. But I could not find a good explanation which confirms that this is indeed the problem and furthermore, I also could not find a solution for that which works. 

After searching the forums and looking at many threads with no answers or solutions, I want to ask for help directly. The lack of error information is making this a really hard problem to troubleshoot. Does anyone know hot to prevent the immediate disconnect?

Thanks!

  • I just tried the same bootloader without any changes on the PCA10040 dev board, and it worked without any issues. I also noticed that logging starts slower on my custom board, e.g. it takes some seconds for all the messages to appear initially. After that, it is fine, and the messages arrive quickly. I did an "erase all" on my custom board several times, so I do not understand what is different?

    One thing I noticed however is that the settings page gets erased on the PCA10040, while my custom board does not do that. Here is the complete log of the boot sequence of the PCA10040:

    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <warning> nrf_dfu_settings: Resetting bootloader settings since neither the settings page nor the backup are valid (CRC error).
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
    <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pending 0
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x200096C8, len=896 bytes), queue usage: 1
    <debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
    <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    <debug> nrf_dfu_settings: Writing settings...
    <debug> nrf_dfu_settings: Erasing old settings at: 0x0007E000
    <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007E000, len=1 pages), queue usage: 1
    <debug> nrf_dfu_flash: Flash erase success: addr=0x0007E000, pending 0
    <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007E000, src=0x20009348, len=896 bytes), queue usage: 1
    <debug> nrf_dfu_flash: Flash write success: addr=0x0007E000, pending 0
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <info> app: Boot validation failed. No valid app to boot.
    <debug> app: DFU mode because app is not valid.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x20005984)
    <debug> app: timer_activate (0x20005984)
    <info> app: Entering DFU mode.
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_ble: Initializing BLE DFU transport
    <debug> nrf_dfu_ble: Setting up vector table: 0x00071000
    <debug> nrf_dfu_ble: Enabling SoftDevice.
    <debug> nrf_dfu_ble: Configuring BLE stack.
    <debug> nrf_dfu_ble: Enabling the BLE stack.
    <debug> nrf_dfu_ble: No advertising name found
    <debug> nrf_dfu_ble: Using default advertising name
    <debug> nrf_dfu_ble: Advertising...
    <debug> nrf_dfu_ble: BLE DFU transport initialized.

    Does that mean something?

  • I found the problem and fixed it: the clock source was set to crystal, and on my module there is no crystal. I changed the settings to the internal RC circuit, and DFU now works.

    The underlying problem on my side was that I already set the clock source for the application and thus forgot about it as a possible issue for the bootloader.

    Actual changes:

    //==========================================================
    
    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
     
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif

Related