As stated above my environment is Mac_VSCode_Arduino_J-Link.
Mac 11.2
VSCode 1.53.0
C/C++ Intellinsense 1.2.0
PlatformIO IDE 2.2.1

When I try to debug or print using println(), I get the following:

> Executing task: pio device monitor <

--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at
--- Miniterm on /dev/cu.usbmodem0002601096781  9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

At this point the system does not work. There is no flashing cursor.

My PlatformIO.ini is as follows:

build_type = debug
platform = nordicnrf52
board = adafruit_feather_nrf52832
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
debug_tool = jlink
upload_protocol = jlink

Could someone please provide insight as to what may be wrong.


  • What code are you flashing to the board?
  • Is the adafruit_feather_nrf52832 really your board? Per schematics that board is supposed to have a CP2104 USB serial adapter. So the Arduino implementation for it probably outputs to the pins connected to the serial adapter accessible via the microUSB port. So, this doesn’t go through the JLink lines (if you haven’t connected to explicitly there… not sure if the JLink has a UART connector)
  • Do you see that additional serial port in PIO Home → Devices when you plug the device in and refresh, and it disappears when you unplug it and refresh?
  • Is the device name

correct for the serial port for the device that pops up?

On my Mac (Big Sur 11.2 as well), I can see two devices starting with / if I plug in the Adafruit Feather board and the J-Link adapter:

  • /dev/cu.usbserial-01812B71: CP2104 USB-to-serial converter on the Feather board
  • /dev/cu.usbmodem0000596186293: Serial connection of J-Link

So you are connecting to the J-Link adapter. Yet the standard Arduino output goes to the CP2104.

Check for a device like /dev/cu.usbserial-... and use it. It can be explicitly configured in platformio.ini:

monitor_port = /dev/cu.usbserial-12345678
1 Like

BTW: I’m assuming that you have connected both the Adafruit board and the J-Link via USB to your Mac. Is this so?

Thanks for the quick response. The nRF52832 is part of a custom board. I am using SWIO and SWCLK for programming and communication with board.

Miniterm on /dev/cu.usbmodem0002601096781 is the port connection to J-link which in turn connects to SWD pads brought from nRF52832 module.

I am using a nRF52832 module and I did not include a CP2104.

Everything programs fine. I just can’t get an output at Terminal to read print statements included in my code.

Serial.println in the Adafruit arduino core maps to the standard UART functionality.

For your configured board the arduino pins for TX and RX would be

Which per this

and schematics linked above link to TXD = P0.06 and RXD = P0.08. So you will be able to see your printf output if you connect a USB-UART adapter to these pins (if your JLink adapter has those pins, you can connect it to there).

This doesn’t use semihosting to transport the output via the SWD connection. Per issue search also noone has ever asked that question. Note sure how to enable it.

In order to use the serial connection, you need to wire the nRF52832’s RX/TX pins to pin 5 (TX) and pin 17 of the J-Link adapter.

1 Like

I think you’re getting close to solving this. I am using an ARM 10-pin connector adapted to an ARM 20-pin Connector plugged into J-Link. I did port pin P.0.06-TX and pin P.0.08-RX from nRF52832 module. Any idea if there is a software configuration for J-link to accept TX and RX and pass it through SWD?

A standard 10-wire SWD connection doesn’t include TX and RX unless you use it in a non-standard way. You would need to build your own adapter from the non-standard SWD to the 20-pin J-Link port.

Another option might be SWO. That’s part of SWD and is available on pin P0.18 of the nrf52832 if I’m not mistaken. In order to use, you would need a an SWO viewer on the Mac. It’s MCU to Mac only, and it probably does not work in combination with the PlatformIO debugger.

And then there’s semihosting. It should work without additional pins and is otherwise similar to SWO. Except it’s slow.

I’m neither familiar with SWO nor semihosting. So you have to dig up the relevant details yourself.

1 Like

Thanks for your assistance. I think data is for unknown reasons being transmitted to serial monitor in PlatformIO.

Meant to say no being transmitted.

Have you checked whether it’s a fault in the JLink or the wiring or the software by connecting a dedicated USB-serial adapter to the aforementioned TXD and GND pins and using any serial monitor program to look at the output?

Basic blinky codes work? (Otherwise it could also be an entirely different issue, like clock init).

Do you have anything connected to pin 17 of your J-Link probe at all?

No I’m using a Arm-JTAG 20-10 adapter and have only 4 connections. Gnd - 3.3v - SWIO - SWCLK. Seems I’m hardly the first person to use PIO connected through J-Link to CPU using SWD.

So it’s not for unknown reasons then. There’s nothing connected to the J-Link’s RX pin.

I really appreciate your help. I connected TX from cpu to SWO pin13. Pin 17 is a no connection pin. I’m more suspect of software mis-configuration for terminal than hardware.

Executing task: pio device monitor <

— Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Miniterm on /dev/cu.usbmodem0002601096781 9600,8,N,1 —
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —

I get to this point when connected to terminal but no cursor shows and no entry is accepted. I’m digging in.

TX (UART) and SWO use two different protocols. They are not compatible. You have to connect the nrf52382’s TX pin to pin 17 of the JLink.

Pin 17 and pin 5 might be documented as NC but they are not. Also see: Using J-Link VCOM functionality - SEGGER Wiki. You can verify it with a multimeter (both pins have a pull-up and go high) or even better with an oscilloscope on pin 5.

And you don’t need to worry about whether this functionality is enabled on your JLink or not. It is. If it was disabled, /dev/cu.usbmodem0002601096781 would not appear.

I understand. I reloaded VSC and added the following to platformio.ini

platform = nordicnrf52
framework = arduino
board = adafruit_feather_nrf52832

debug_tool = custom
debug_port = :2331

debug_server =

debug_init_cmds =
  define pio_reset_halt_target
      monitor reset
      monitor halt
  define pio_reset_run_target
      monitor clrbp
      monitor reset
      monitor go
  target extended-remote $DEBUG_PORT
  monitor clrbp
  monitor speed auto

I now have a blinking cursor and use the terminal function. I connect pin 17 and give it a whirl.

1 Like

What do you know. Connecting Pin 17 to TX worked. Print is now working. Can’t thank you enough for following through to a logical conclusion.

Ain’t this fun?