This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using SWO with nRF52 (redux)

I know this question has been asked before, but I couldn't find an answer...

I'm looking for an example of how to use the nRF52832's SWO feature with the SEGGER JLink product. I have a PCA10040 board that I can program and debug via Eclipse/GCC/Jlink. I would now like to use the SWO feature to simulate a virtual UART. (I realize that I could use the PCA10040's real UART but my eventual target doesn't have the UART so I want to use the SWO feature instead.)

I have set the following additional defines in my otherwise unchanged Nordic sample code: CFLAGS += -DENABLE_DEBUG_LOG_SUPPORT

CFLAGS += -DNRF_LOG_USES_RTT=1

CFLAGS += -DENABLE_SWO

With these settings I can single step through the initialization and write attempts to the SEGGAR functions found in the nordic SDK (external/segger_rtt/SEGGER_RTT*). This all looks fine.

I have tried to view the RTT output using JLinkGDBServer and JLinkSWOVIewer. Neither of these applications sees any output from my target.

Here is the output from JLinkGDBServer console:

SEGGER J-Link GDB Server V5.12e Command Line Version

JLinkARM.dll V5.12e (DLL compiled Apr 29 2016 15:06:43)

-----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: yes

Generate logfile: off

Verify download: off

Init regs on start: off

Silent mode: off

Single run mode: off

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: nRF52832_xxAA

Target interface: SWD

Target interface speed: 4000kHz

Target endian: little

Connecting to J-Link...

J-Link is connected.

Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17

Hardware: V1.00

S/N: 682957762

Checking target voltage...

Target voltage: 3.30 V

Listening on TCP/IP port 2331

Connecting to target...Connected to target

Waiting for GDB connection...Connected to 127.0.0.1

Reading all registers

Read 4 bytes @ address 0x0001D2AA (Data = 0xEB0A45BB)

Reading 8 bytes @ address 0x2000FEB8

...

gdb> mon SWO EnableTarget 0 0 1 0

SWO enabled succesfully.

gdb> mon SWO Start 0 900000

SWO started.

--- END OF QUOTE ---

I have connected to both SWO related telnet ports (2332 and 2333) and nothing comes out. I am guessing that I am not sending the correct commands to JLink monitor for this board but I can't seem to find any documentation that describes what it should be.

Any help would be appreciated.

Jack

Related