How to send rtt shell command to my nrf54l15 device

I have added shell console and its support into my nrf54l15 device and it worked well like below.

But now I want to use a python script to run this "bt" shell command in my device, how can I do this?

These below are my python script now.

I tried to use  jlink.rtt_write(0, b"bt") to send a "bt" shell command, but I seemed to get nothing response.  I think it connect successfully becaues it print the "successfully" log.BTW, please ignore the device NRF52840_XXAA in the script even if my device is actually nrf54l15.

<test.py>

import pylink

jlink = pylink.JLink()
jlink.open()
jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
jlink.connect('NRF52840_XXAA')

jlink.rtt_start()
print('Successfully connect to device')

jlink.rtt_write(0, b"bt")

response = jlink.rtt_read(0, 16)

print("LOG", response)

Related