When enabling RTT the program runs until the first NRF_LOG_PROCESS() Verification and then directly in the HardFault-Handler

Hello,

our project which started 7 years ago with SDK13.0 has been migrated some time ago to SDK 15.3 and now to SDK17.1. At the beginning we were quite happy with the RTT functions, but since a certain time (maybe beginning with SDK15.3) we can not use it any more because the firmware runs directly to the HardFault handler.

We have verified and updated our code already using some tickets from this forum like 

  • Case ID: 123565: RTT & RTT disable sdk 12/13 nRF52832/nRF52840
    or
  • Case ID: 213834: RTT Logging not working when building with ARM GCC
    or
  • Case ID: 128187: RTT logs broken in SDK14.2 with GCC

but still RTT does not work.

In sdk_config.h we have defined

NRF_LOG_ENABLED = 1

NRF_LOG_BACKEND_RTT_ENABLED = 1

NRF_LOG_BACKEND_SERIAL_USES_RTT = 1

NRF_LOG_BACKEND_SERIAL_USES_UART = 0

I have joined a screenshot from the debugging phase where the first NRF_LOG_PROCESS() check is done, at the left side of the screenshot

you can see how the µC runs to the HardFault Handler.

We use the nRF52840 and gcc GNU_ARM/9 2020-q2-update.

What can we do to make RTT run? 

BR, matthK

Parents
  • Hi!

    You should check the hardfault info to see why it hardfaulted.

    See this post on how to enable the hardfault handler library:

     RE: Catch HardFault 

     

  • Hi Sigurd,

    following the description I have enabled the hardfault handler library, but I don't see any difference when running the CPU. Where can I get the needed information? 

  • Hi!

    Maybe start with one of the examples in the SDK, and try to configure and make it fail similar to what you are experiencing with your application.

  • Hello Sigurd,

    I chose the HRS-project like 7 years ago when I started the development of this product in a first version using nRF52832.

    Since 3 years we use nRF52840 in the 2nd generation of this product, still using Eclipse and gcc as IDE. But I have problems now to configure the gdb server to make it run with PCA10056. In our Firmware project using a Segger JTrace Pro for Cortex-M everything works perfect.

    Is there a manual or a recommendation How to configure the gdb server for working with PCA10056?

    BR, matthk

  • Hi!

    matthk said:
    Is there a manual or a recommendation How to configure the gdb server for working with PCA10056?

    I found this guide from 2019, maybe that can be of help. 

     Using GDB with Nordic devices 

  • Hello Sigurd,

    it seems that there are some connection problems with the PCA10056 and my Laptop. When I start the Programmer (v4.6.0)  from nRF Connect for Desktop and select my nRF52840 DK with the series number 001050281280 I see some configuration action with partly red highlighted messages; the log-file contains this:

    2025-06-17T09:49:30.089Z INFO Initialising the bundled nrfutil device
    2025-06-17T09:49:30.113Z DEBUG Application data folder: C:\Users\mak\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    2025-06-17T09:49:30.181Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:30.182Z DEBUG App pc-nrfconnect-programmer v4.6.0 (official)
    2025-06-17T09:49:30.182Z DEBUG App path: C:\Users\mak\.nrfconnect-apps\node_modules\pc-nrfconnect-programmer
    2025-06-17T09:49:30.182Z DEBUG nRFConnect 5.2.0, required by the app is (>=5.2.0)
    2025-06-17T09:49:30.183Z DEBUG nRFConnect path: C:\Users\mak\AppData\Local\Programs\nrfconnect\resources\app.asar
    2025-06-17T09:49:30.183Z DEBUG HomeDir: C:\Users\mak
    2025-06-17T09:49:30.183Z DEBUG TmpDir: C:\Users\mak\AppData\Local\Temp
    2025-06-17T09:49:30.261Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:30.768Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:30.768Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:30.772Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:30.804Z INFO Using the bundled core version for nrfutil device: 8.0.0
    2025-06-17T09:49:30.849Z INFO Using nrfutil-device version: 2.10.2
    2025-06-17T09:49:30.849Z INFO Using nrf-device-lib version: 0.17.71
    2025-06-17T09:49:30.849Z INFO Using nrf-probe version: 0.38.0
    2025-06-17T09:49:30.849Z INFO Using JLink version: JLink_V8.18
    2025-06-17T09:49:30.948Z INFO Getting serial port options from the persistent store for 001050281280.pc-nrfconnect-programmer
    2025-06-17T09:49:30.949Z INFO Device connected with the serial number 001050281280
    2025-06-17T09:49:30.950Z DEBUG Sending event "programmer: device connected"
    2025-06-17T09:49:34.174Z INFO Selecting device with the serial number 001050281280
    2025-06-17T09:49:34.183Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:34.656Z ERROR Error: Failed with exit code 1.
    One or more device info tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Operation device-info failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).
    2025-06-17T09:49:34.656Z INFO Selected device with the serial number 001050281280
    2025-06-17T09:49:34.657Z INFO Using nrfutil device to communicate with target via JLink
    2025-06-17T09:49:34.662Z DEBUG Sending event "programmer: device selected"
    2025-06-17T09:49:34.663Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:34.733Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:49:34.986Z INFO Reading readback protection status for Application core
    2025-06-17T09:49:34.989Z INFO Reading readback protection status for Application core 0%
    2025-06-17T09:49:35.132Z ERROR Failed "reading readback protection status for application core". Error: code: 1, description: Generic, message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1)
    2025-06-17T09:49:35.162Z ERROR Error: Failed with exit code 1.
    One or more batch tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).
    2025-06-17T09:49:35.162Z ERROR Error: Failed with exit code 1.
    One or more batch tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).
    2025-06-17T09:49:54.608Z INFO Deselected device
    2025-06-17T09:49:54.609Z DEBUG Sending event "programmer: device deselected "
    2025-06-17T09:50:06.344Z INFO Selecting device with the serial number 001050281280
    2025-06-17T09:50:06.352Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:50:06.858Z ERROR Error: Failed with exit code 1.
    One or more device info tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Operation device-info failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).
    2025-06-17T09:50:06.859Z INFO Selected device with the serial number 001050281280
    2025-06-17T09:50:06.859Z INFO Using nrfutil device to communicate with target via JLink
    2025-06-17T09:50:06.862Z DEBUG Sending event "programmer: device selected"
    2025-06-17T09:50:06.862Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:50:06.939Z DEBUG Sending event "programmer: running nrfutil device"
    2025-06-17T09:50:07.190Z INFO Reading readback protection status for Application core
    2025-06-17T09:50:07.191Z INFO Reading readback protection status for Application core 0%
    2025-06-17T09:50:07.323Z ERROR Failed "reading readback protection status for application core". Error: code: 1, description: Generic, message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1)
    2025-06-17T09:50:07.346Z ERROR Error: Failed with exit code 1.
    One or more batch tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).
    2025-06-17T09:50:07.346Z ERROR Error: Failed with exit code 1.
    One or more batch tasks failed:
    * 1050281280: Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1) (Generic).
    Message: Batch task protection-get failed, Device error: Failed to write DebugPort register 0x08: Unknown Error in J-Link DLL (error code =-1).

    What can I do now?

    BR, matthK

  • I have some more information: When compiling the Blinky example and trying to download to this PCA10056 in Eclipse an error message is displayed:

    In the console window this is displayed:

    SEGGER J-Link GDB Server V8.18 Command Line Version

    JLinkARM.dll V8.18 (DLL compiled Mar 5 2025 14:42:43)

    Command line: -if swd -device nRF52840_xxAA -endian little -speed 2000 -port 2331 -swoport 2332 -telnetport 2333 -vd -ir -localhostonly 1 -singlerun -strict -timeout 0 -nogui

    -----GDB Server start settings-----

    GDBInit file: none

    GDB Server Listening port: 2331

    SWO raw output listening port: 2332

    Terminal I/O port: 2333

    Accept remote connection: localhost only

    Generate logfile: off

    Verify download: on

    Init regs on start: on

    Silent mode: off

    Single run mode: on

    Target connection timeout: 0 ms

    ------J-Link related settings------

    J-Link Host interface: USB

    J-Link script: none

    J-Link settings file: none

    ------Target related settings------

    Target device: nRF52840_xxAA

    Target device parameters: none

    Target interface: SWD

    Target interface speed: 2000kHz

    Target endian: little

    Connecting to J-Link...

    J-Link is connected.

    Firmware: J-Link OB-nRF5340-NordicSemi compiled Feb 11 2025 17:15:35

    Hardware: V1.00

    S/N: 1050281280

    Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB

    Checking target voltage...

    Target voltage: 3.30 V

    Listening on TCP/IP port 2331

    Connecting to target...

    ERROR: Could not connect to target.

    Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...

    Shutting down...

    As the target voltage is measured correctly I have the impression, that the debugger chip has no valid communication with the nRF52840. Is there a special configuration / jumpers at the PCA10056 to consider?

    BR matthK

Reply
  • I have some more information: When compiling the Blinky example and trying to download to this PCA10056 in Eclipse an error message is displayed:

    In the console window this is displayed:

    SEGGER J-Link GDB Server V8.18 Command Line Version

    JLinkARM.dll V8.18 (DLL compiled Mar 5 2025 14:42:43)

    Command line: -if swd -device nRF52840_xxAA -endian little -speed 2000 -port 2331 -swoport 2332 -telnetport 2333 -vd -ir -localhostonly 1 -singlerun -strict -timeout 0 -nogui

    -----GDB Server start settings-----

    GDBInit file: none

    GDB Server Listening port: 2331

    SWO raw output listening port: 2332

    Terminal I/O port: 2333

    Accept remote connection: localhost only

    Generate logfile: off

    Verify download: on

    Init regs on start: on

    Silent mode: off

    Single run mode: on

    Target connection timeout: 0 ms

    ------J-Link related settings------

    J-Link Host interface: USB

    J-Link script: none

    J-Link settings file: none

    ------Target related settings------

    Target device: nRF52840_xxAA

    Target device parameters: none

    Target interface: SWD

    Target interface speed: 2000kHz

    Target endian: little

    Connecting to J-Link...

    J-Link is connected.

    Firmware: J-Link OB-nRF5340-NordicSemi compiled Feb 11 2025 17:15:35

    Hardware: V1.00

    S/N: 1050281280

    Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB

    Checking target voltage...

    Target voltage: 3.30 V

    Listening on TCP/IP port 2331

    Connecting to target...

    ERROR: Could not connect to target.

    Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...

    Shutting down...

    As the target voltage is measured correctly I have the impression, that the debugger chip has no valid communication with the nRF52840. Is there a special configuration / jumpers at the PCA10056 to consider?

    BR matthK

Children
No Data
Related