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,

    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

  • Hi,

    It's the log file with the bootloader_debug only:

    ###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.40 - Real time terminal output

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

    Process: emStudio

    and this is the log file with bootloader,settings,softdevice and app:

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

    best regards,

    zhong

Reply
  • Hi,

    It's the log file with the bootloader_debug only:

    ###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.40 - Real time terminal output

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

    Process: emStudio

    and this is the log file with bootloader,settings,softdevice and app:

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

    best regards,

    zhong

Children
  • Hi,

    There is no RTT output here, just printouts from JLinkExe. You also need to connect to JLinkExe via telnet, as described in the end in the post I linked to.

  • Hi,

    It's the log file:

    <debug> nrf_sdh: State request: 0x00000000

    <debug> nrf_sdh: State change: 0x00000000

    <debug> nrf_sdh: State change: 0x00000001

    <debug> nrf_sdh_ble: RAM starts at 0x20002AA8

    <info> app: Debug logging for UART over RTT started.

    <debug> nrf_sdh_ble: BLE event: 0x10.

    <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.

    <info> app: Connected

    <debug> nrf_sdh_ble: BLE event: 0x3A.

    0xF7

    x0.

    <debug> nrf_sdh: State request: 0x00000000

    <debug> nrf_sdh: State change: 0x00000000

    <debug> nrf_sdh: State change: 0x00000001

    <debug> nrf_sdh_ble: RAM starts at 0x20002AA8

    <info> app: Debug logging for UART over RTT started.

    <debug> nrf_sdh_ble: BLE event: 0x10.

    <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.

    <info> app: Connected

    <debug> nrf_sdh_ble: BLE event: 0x3A.

    <debug> nrf_ble_gatt: ATT MTU updated to 185 bytes on connection 0x0 (response).

    <info> app: Data len is set to 0xB6(182)

    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7

    <debug> nrf_sdh_ble: BLE event: 0x24.

    <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0.

    <debug> nrf_ble_gatt: max_rx_octets: 251

    <debug> nrf_ble_gatt: max_tx_octets: 251

    <debug> nrf_ble_gatt: max_rx_time: 2120

    <debug> nrf_ble_gatt: max_tx_time: 2120

    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7

    <debug> nrf_sdh_ble: BLE event: 0x23.

    <debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 251 bytes.

    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.

    <debug> nrf_sdh_ble: BLE event: 0x24.

    <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0.

    <debug> nrf_ble_gatt: max_rx_octets: 251

    <debug> nrf_ble_gatt: max_tx_octets: 251

    <debug> nrf_ble_gatt: max_rx_time: 2120

    <debug> nrf_ble_gatt: max_tx_time: 2120

    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7

    <debug> nrf_sdh_ble: BLE event: 0x50.

    <debug> nrf_sdh_ble: BLE event: 0x52.

    <debug> nrf_sdh_ble: BLE event: 0x50.

    <info> app: Received indication state 1

    <debug> nrf_sdh_ble: BLE event: 0x51.

    <debug> nrf_sdh_ble: BLE event: 0x53.

    <info> app: Device is preparing to enter bootloader mode.

    <debug> app: Disconnected connection handle 0

    <info> app: Disconnected 1 links.

    <debug> app: In ble_dfu_buttonless_bootloader_start_finalize

    <info> app: Device will enter bootloader mode.

    <info> app: Power management wants to reset to DFU mode.

    <info> app: Power management allowed to reset to DFU mode.

    and I can finish dfu when I open the RTT mode,but If I don't use RTT to test.It won't finish the dfu Just like before(always in 100%),Is it normal?(app“nrf connect”in iphone).

    best regards,

    zhong

  • Hi,

    This RTT log only covers the application. That is an unfortunate consequence of the RTT viewer only searching for the RTT buffer once, as described here and here. Can you try to disconnect the RTT viewer and connect again after entering DFU mode? That way you should get the bootloader RTT output. (alternatively, you could make sure that the RTT buffer of the application and bootloader is in the same memory address).

  • Hi,

    I try to disconnect the RTT viewer and connect again after entering DFU mode.but nothing I can find,

    and then I try the dfu in another phone(android),unfortunately,even if I open the RTT ,The dfu fail too.

    It's the information in RTT viewer and in the phone:

    1.RTT viewer

    Process: JLinkExe

    <debug> nrf_sdh: State request: 0x00000000

    <debug> nrf_sdh: State change: 0x00000000

    <debug> nrf_sdh: State change: 0x00000001

    <debug> nrf_sdh_ble: RAM starts at 0x20002AA8

    <info> app: Debug logging for UART over RTT started.

    <debug> nrf_sdh_ble: BLE event: 0x10.

    <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.

    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.

    <info> app: Connected

    <debug> nrf_sdh_ble: BLE event: 0x3A.

    <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).

    <info> app: Data len is set to 0xF4(244)

    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7

    <debug> nrf_sdh_ble: BLE event: 0x24.

    <debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.

    <debug> nrf_ble_gatt: max_rx_octets: 27

    <debug> nrf_ble_gatt: max_tx_octets: 27

    <debug> nrf_ble_gatt: max_rx_time: 328

    <debug> nrf_ble_gatt: max_tx_time: 328

    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7

    <debug> nrf_sdh_ble: BLE event: 0x12.

    2.in the phone

    what' the matter?

    best regards,

    zhong

  • Hi,

    1. This seems to be RTT log from the application. Is the bootloader running? Another way of making sure that the RTT log of the debug bootloader is printed is to disable RTT logging in the application. This way you know there is no "residue" RTT buffer from the application in RAM. Also remember that it only the debug bootloader that has RTT logging.

    2. The phone shows that there are no DFU characteristics. This indicates that neither the bootloader nor an application with the buttonless DFU service is running. Can you double check?

Related