Skip to content

RTT does not connect #233

@Celppu

Description

@Celppu

I cannot get RTT to connect nrf54L15. I can get RTT viewer in nrf connect to show logs.

When I run the code, second jlink instance is launched. in http://localhost:19080/rtt.htm I see burst of logs via RTT, but second instance from python http://localhost:19081/rtt.htm show nothing - How does the instances work??

code i have been tinkering with:

import pylink
import time
import sys

# Set your known values
SERIAL_NUMBER = 1057703614
DEVICE_NAME = 'nRF54L15_M33' 

# Connect to the J-Link probe
jlink = pylink.JLink()

try:
    print(f"Connecting to J-Link serial {SERIAL_NUMBER}...")
    jlink.open(serial_no=SERIAL_NUMBER)

    #print(f"Connecting to target device: {DEVICE_NAME}...")
    jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
    jlink.connect(DEVICE_NAME)

    print(f"Connected? {jlink.target_connected()}")

    print("Starting RTT...")
    #0x200009BC
    #jlink.rtt_start(block_address=0x200009BC)
    
    jlink.reset(ms =1)

    time.sleep(0.001)

    jlink.rtt_start(block_address=0x200009BC)

    print(f"RTT started. Waiting for RTT to be ready... {jlink.rtt_get_status()}")


    # Optional: wait for RTT to stabilize
    while True:
        try:
            num_up = jlink.rtt_get_num_up_buffers()
            if num_up > 0:
                break
        except pylink.errors.JLinkRTTException:
            pass
        time.sleep(0.1)

    print("RTT connected. Reading channel 0:\n")

    try:
        while True:
            try:
                if jlink.rtt_get_num_up_buffers() == 0:
                    print("RTT buffers lost. Trying to re-sync...")
                    jlink.rtt_stop()
                    time.sleep(0.1)
                    jlink.rtt_start()
                    continue

                data = jlink.rtt_read(0, 1024)
                if data:
                    print(bytes(data).decode(errors='ignore'), end='')
                else:
                    time.sleep(0.01)

            except pylink.errors.JLinkRTTException:
                print("RTT read error. Reconnecting...")
                jlink.rtt_stop()
                time.sleep(0.1)
                jlink.rtt_start()

    except KeyboardInterrupt:
        print("\nClosing.")
        jlink.close()
except KeyboardInterrupt:
    print("\nKeyboard interrupt received. Closing J-Link...")
    jlink.close()
    sys.exit(0)

except pylink.errors.JLinkException as e:
    print(f"J-Link error: {e}")
    jlink.close()
    sys.exit(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions