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

Problem 'stopped by vector catch' in allocating RAM when I added a new ble service" (nrf52840 sdk15.3.0)

Hello,everyone

I want to add dfu service in UART example ,but when I tried to allocate the RAM,Debug terminal shows nothing,Then I set the breakpoint in nrf_sdh_ble.c and debugging,I can't enter the C file,

After I set breakpoint in main.c,I found that when debug goes to "ble_stack_init();",It will be block and I can't do anything,like the images:

1.before  debug "ble_stack_init();"

2.after  debug "ble_stack_init();"

it shows"restricted memory" in Watch,and The window "output" shows"stopped by vector catch",If I start"built and run" directly,It can succeed,but I think it doesn;t make anythings,Finally,I see maybe I can use app_error_handler_bare(), unfortunately I don't know how to use it.could you please give me some help? thanks!

best regards,

zhong

Parents Reply Children
  • Hi AndreasF,

    I try the chapter 8 or 9 in this tutorial,but there a problem occurs,

    1.In chapter 8

    First,I set the RAM like this in configuration debug,like this image.(sdk15.3.0,softdevice6.1.1)

    and then I change the define in sdk_config.h which are shown in chapter 8.after I cancel all the breakpoint and click "go" in option "debug",but it's nothing in debug terminal,like the image.

    Finally I click "go" once more,it shows"stopped by vector catch"

    2.in chapter 9

    In this way ,I set a breakpoint in line" ret_code_t ret_code = sd_ble_enable(p_app_ram_start);" shown in chapter 9, and then I click "go" in option"debug" once time ,the result like this image:

    and then I click"go" once more,The debug never jump into the breakpoint which I set and it was blocked wtih"stopped by vector catch",like the image:

    So what should I do?and if there are some tutorial which can tell me how to allocate RAM when I want to add a new service in a example(add dfu_buttonless service is better),Look forward to your help,thanks!

    best regards,

    zhong

  • Hi.

    I think the error "Stopped by vector catch" is related to a Hardfault.

    How did you add the dfu_buttonless Service? Did you follow the Infocenter Guide?

    Perhaps this Hardfault occurs because the dfu_buttonless Service is not configured correctly.

    Best regards,

    Andreas

  • hello,AndreasF

    I will try the Infocentor Guide,what diffrerence entre the dfu_buttonless service and dfu_secure_buttonless service?so I just should do the things step by step by "add secure_buttonless_dfu service in ble application"? now I am using the tutorial for this website.http://www.sunyouqun.com/2018/04/nordic-ble-dfu-4-buttonless-app/

    it's Chinese and other person was success in using it, all the changes are shown in the form of pictures. Now I explain the work I have done.

    first,Open the <sdk>\examples\ble_peripheral\ble_app_hrs project to make sure the project works

    1.Add source file
    Add a folder nRF_DFU to the project and add the following files:

    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu.c
    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu_bonded.c
    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c
    <sdk>\components\libraries\bootloader\dfu\nrf_dfu_svci.c

    2.Add Include directory
    Find User Include Directories in the project configuration window and add the following path:

    ../../../../../../components/libraries/bootloader
    ../../../../../../components/libraries/bootloader/ble_dfu
    ../../../../../../components/libraries/bootloader/dfu
    ../../../../../../components/libraries/svc
    If you use SEGGER Embedded Studio, you need to pay extra attention to the spaces at the end of these paths, which may result in not being recognized correctly.

    3.Add macro switch
    Find Preprocessor Definitions in the Project Configuration window and add the following items:

    NRF_DFU_SVCI_ENABLED
    NRF_DFU_TRANSPORT_BLE=1
    BL_SETTINGS_ACCESS_ONLY

    4.Configuring sdk_config
    In sdk_config.h, make the following changes:

    BLE_DFU_ENABLED = 1
    NRF_SDH_BLE_VS_UUID_COUNT += 1

    5.Add header file
    Add the following header file to main.c:

    #include "nrf_dfu_ble_svci_bond_sharing.h"
    #include "nrf_svci_async_function.h"
    #include "nrf_svci_async_handler.h"
    #include "ble_dfu.h"
    #include "nrf_power.h"
    #include "nrf_bootloader_info.h"

    6.Add code
    Open the main.c of the Buttonless sample project and copy the following functions into the main.c of the current project:

    Add Buttonless DFU Service:

    static bool app_shutdown_handler(nrf_pwr_mgmt_evt_t event){};
    NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 0);
    static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context){};
    NRF_SDH_STATE_OBSERVER(m_buttonless_dfu_state_obs, 0) = {};
    static void ble_dfu_evt_handler(ble_dfu_buttonless_evt_type_t event){};


    Add the DFU service at the end of the main.c/services_init function:

     

    ble_dfu_buttonless_init_t dfus_init = {0};
    
    // Initialize the async SVCI interface to bootloader.
    err_code = ble_dfu_buttonless_async_svci_init();
    APP_ERROR_CHECK(err_code);
    
    dfus_init.evt_handler = ble_dfu_evt_handler;
    
    err_code = ble_dfu_buttonless_init(&dfus_init);
    APP_ERROR_CHECK(err_code);    

    7.Adjust memory address
    Follow the steps above and walk down, you can already compile. Burn Softdevice and Application, open the serial port tool, you should see the log message prompts that the memory address and memory size need to be adjusted.

    (In this step, I didn't see any information on the serial port, so I don't know how to modify the RAM, maybe the memory of nrf52840 is enough)

    Then I can compile and get the app.hex file

    8.Bootloader settings

    I confirmed that I used the correct version of softdevice and bootloader (s140_nrf52_6.1.1_softdevice.hex and complie the file in sdk15.3.0/example/dfu/secure_bootloader/pca10056 folder to get the bootloader.hex), and then got the final hex file by the following command. 

    nrfutil settings generate --family NRF52840 --application app.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hex

    mergehex --merge bootloader.hex s140_nrf52_6.1.1_softdevice.hex --output production_final1.hex

    mergehex --merge production_final1.hex app.hex --output production_final2.hex

    mergehex --merge production_final2.hex settings.hex --output production_final.hex

    nrfjprog --eraseall -f NRF52

    nrfjprog -f NRF52 --program "production_final.hex" --verify  

    nrfjprog --reset -f NRF52

    That's all the things I have done,I don't know where is the problem which cause the situation that I can't allocated RAM.Look forward to your reply~

    best regards,

    zhong

  • hello,AndreasF

    I do the thing in the infocenter guide,I add the code and set 

    NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY 1 

    and there are some errors in the image

    which files should I add?

  • Hi zhong.

    Have you added the source files and header files?

    zhong said:

    1.Add source file
    Add a folder nRF_DFU to the project and add the following files:

    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu.c
    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu_bonded.c
    <sdk>\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c
    <sdk>\components\libraries\bootloader\dfu\nrf_dfu_svci.c

    ../../../../../../components/libraries/bootloader
    ../../../../../../components/libraries/bootloader/ble_dfu
    ../../../../../../components/libraries/bootloader/dfu
    ../../../../../../components/libraries/svc

     Have you defined m_ready_for_reset?

    Best regards,

    Andreas

Related