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
  • Hi zhong.

    For the issue with Restricted Memory Range, please read this.

    For adjustment of RAM, please read this tutorial and look at chapter 8 or 9.

    Best regards,

    Andreas

  • 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 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

  • hello,AndreasF,

    I try it,and then I receive the message like this:

     nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
    
     nrf_sdh_ble: Change the RAM start location from 0x20002A98 to 0x20002AA8.
    
     nrf_sdh_ble: Maximum RAM size for application is 0x3D558.
    
     nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
    
     app: ERROR 4 [NRF_ERROR_NO_MEM] at /Users/zz/Desktop/stage5a/heatzy_pilote/BLE_Projects/nRF5_SDK_15.3.0_59ac345/examples/ble_peripheral/ble_app_uart/main.c:508
    
    PC at: 0x0002EC1B
    
    

    so,how to change the section placement marcos?I use the soft6.1.1 and sdk 15.3.0,This is my setting(I set by the tutorial:https://devzone.nordicsemi.com/tutorials/b/getting-started/posts/adjustment-of-ram-and-flash-memory),I don't know the exact mean about FLASH_PH_START and FLASH_PH_SIZE.etc

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x26000

    FLASH_SIZE=0xda000

    RAM_START=0x20002a98

    RAM_SIZE=0x3d568

    so I just change the RAM_START and RAM_SIZE?or I should also change other things like FLASH_PH_START or FLASH_START. Look forward to your reply.

    best regards,

    zhong

  • hello,AndreasF,

    I changed my section placement marcos by the warning:

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x26000

    FLASH_SIZE=0xda000

    RAM_START=0x20002aa8

    RAM_SIZE=0x3d558

    and then I "build and run" in order to get the output.hex.After this,I make the setting file and mix the settings.hex,app.hex,softdevice.hex and bootloader.hex by using the code below:

    nrfutil settings generate --family NRF52840 --application app.hex --application-version 1 --bootloader-version 1 --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

    finally I can connect the nrf52840 which is named "UART service" by my phone,but I can only find that there is only a service named UART service,I can't find the dfu service, what should I do?

    best regards,

    zhong

  • hello,AndreasF,

    I try it again, and it also only shows the UART service,could you please help me find the solution?Thanks a lot.

    best regrads,

    zhong

  • Hi,

    This thread started with correcting the memory configuration of the application and SoftDevice, to allow you to add more services. That seems to not be the current issue?

    If you don't get any errors but still don't see the DFU service there are two possible reasons that comes to mind:

    • You do not actually initialize the DFU service. Can you verify that you do, and possibly upload your code so that I can check it?
    • Another possible explanation is that even if you have added the DFU service is might not show up in your phone as it may have cached the services. In that case you could remove the device from your phone and toggle airplane mode on and off before reconnecting. This way you know that it will perform a new service discovery.
Reply
  • Hi,

    This thread started with correcting the memory configuration of the application and SoftDevice, to allow you to add more services. That seems to not be the current issue?

    If you don't get any errors but still don't see the DFU service there are two possible reasons that comes to mind:

    • You do not actually initialize the DFU service. Can you verify that you do, and possibly upload your code so that I can check it?
    • Another possible explanation is that even if you have added the DFU service is might not show up in your phone as it may have cached the services. In that case you could remove the device from your phone and toggle airplane mode on and off before reconnecting. This way you know that it will perform a new service discovery.
Children
Related