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

  • 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.
  • Hi Einar,

    I fail in last step.I want to use dfu service to update.The progress bar is becoming 100% and nothing happened,The update file I use is blinky_example.I think if I can start OTA service.maybe it's not the problem about the update file,so what should I do?like the image, it can't be finished,and then it will return to the original service(UART service with dfu service) automatically,Thanks for your patient.

    best regards

    zhong

  • Hi Zhong,

    I see. Since you are able to transfer the image, you have successfully entered DFU mode in the bootloader. Therefor this issue is not related to the DFU service.

    Can you test with a debug bootloader, and upload the RTT log to this case? The bootloader has extensive logging, so the log should hopefully tell us more about what is going on.

Reply Children
  • Hi,Einar,

    I tested with a debug bootloader,it's named DfuTarg,but the same situation occured,it's always in 100% and then back to the orignal service(dfuTarg), and now i'm using the macos and I don't know how to get the RTT log. could you please tell me how to get the RTT log and I will update it quickly.

    best regards,

    zhong

  • Hi,

    The debug bootlaoder use RTT logging by default, so you just need to connect a J-link debugger (unless you use the DK, which has one onboard) and start the J-Link RTT Viewer. This should have allready been installed on your computer, assuming you use Windows and have installed nRF5 Command Line Tools.

  • Hi Einar,

    ok,so I can do it in mac os? I will do it, by the way,maybe my update-zip.file is incorrecct.It's my process:

    1.get the output file.hex in example hrs.and named "app_new.hex"

    2.use command:

    nrfutil pkg generate --application app_new.hex --application-version 1 --application-version-string "1.0.0" --hw-version 52 --sd-req 0xB6 --sd-id 0xB6 --softdevice s140_nrf52_6.1.1_softdevice.hex --key-file priv.pem FW.zip

    and I download the zipfile and use it.

    Is there any problem?looking forward to your reply.

    best regards,

    zhong

  • Hi,

    Yes, you can use RTT logging on Mac as well, but it is a bit less user friendly. You can follow the same basic instructions as for Linux, for instance from this post.

    Your nrfutil command looks mostly OK. However, you should increase the application-version, as the bootloader will prevent you to upgrade to the same or lower version number (unless NRF_DFU_APP_DOWNGRADE_PREVENTION is set to 0 in the bootloaders sdk_config.h).

  • Hi,

    I try this and I get these things:

    JLinkRTTClient

    ###RTT Client: ************************************************************

    ###RTT Client: *               SEGGER Microcontroller GmbH                *

    ###RTT Client: *   Solutions for real time microcontroller applications   *

    ###RTT Client: ************************************************************

    ###RTT Client: *                                                          *

    ###RTT Client: *       (c) 2012 - 2016  SEGGER Microcontroller GmbH       *

    ###RTT Client: *                                                          *

    ###RTT Client: *     www.segger.com     Support: [email protected]       *

    ###RTT Client: *                                                          *

    ###RTT Client: ************************************************************

    ###RTT Client: *                                                          *

    ###RTT Client: * SEGGER J-Link RTT Client   Compiled Mar 22 2019 17:28:45 *

    ###RTT Client: *                                                          *

    ###RTT Client: ************************************************************

    ###RTT Client: -----------------------------------------------

    ###RTT Client: Connecting to J-Link RTT Server via localhost:19021  Connected.

    SEGGER J-Link V6.44c - Real time terminal output

    J-Link OB-SAM3U128-V2-NordicSemi compiled Jan  7 2019 14:07:15 V1.0, SN=683732423

    Process: JLinkExe

    Where can I find the exact file?and I try to change the application-version at 2,The same situation occured ,and I simply use the DfuTarg,It failed too.What should I do next?

    best regards,

    zhong

Related