Where does Zephyr printk print?


I’m going through the Zephyr examples (e.g. this) with an Adafruit Bluefruit nRF52832 Feather and just using the CLI (I’m using Emacs, not VS Code).

It works, but I’m a bit confused about the printing. Where does printk print? There’s no serial port available, if I run pio device monitor, then it just prints:

--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters

--- Available ports:
--- Enter port index or full name: 

I might be missing something obvious…

Uhm, the board does have a USB-serial converter on board (schematics from adafruit). A CP2104. If you plug in the device via USB, that thing must show up. How did you upload the code in the first place? Can you show a picture of your board?

Sorry for the confusion, I meant that the serial port doesn’t show up on the computer.

For the Zephyr code I used a J-link to upload the code (blinky, BLE example).
I also used the Arduino framework earlier with the adafruit-nrfutil tool that uses the USB to flash the board, and ttyACM0 came up properly that time.
Here’s a photo of the board:

Well but if you upload via JLink then you don’t have a serial port, since printf probably goes out the hardware UART that in turn goes to the USB-serial adapter? Have you tried reading from the USB serial?

Also, the way I read it on https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_CONSOLE_HAS_DRIVER.html#cmdoption-arg-CONFIG_CONSOLE_HAS_DRIVER, there are several possible options for what the “Console” is – UART, RTT (that can also be read with special JLink software), Semihosting, …

Also there’s an option that printk output is forwarded to the console at all that should probably be turned on: https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_PRINTK.html

And other related options: https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_CONSOLE.html#cmdoption-arg-CONFIG_CONSOLE, https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SEGGER_SYSTEMVIEW.html#cmdoption-arg-CONFIG_SEGGER_SYSTEMVIEW

Though the best way to get answers for Zephyr specific questions would be Discussions · zephyrproject-rtos/zephyr · GitHub. Note that the PlatformIO specific documemtation for Zephyr is at Zephyr RTOS — PlatformIO latest documentation.