Skip to content

app: Enable UART application log by default#281

Merged
MarkusLassila merged 1 commit into
nrfconnect:mainfrom
MarkusLassila:default-uart-tracing
May 7, 2026
Merged

app: Enable UART application log by default#281
MarkusLassila merged 1 commit into
nrfconnect:mainfrom
MarkusLassila:default-uart-tracing

Conversation

@MarkusLassila
Copy link
Copy Markdown
Contributor

@MarkusLassila MarkusLassila commented May 6, 2026

  • Application logs are by default going to UART1, when the AT#XLOG=1 is given.
  • RTT application logs are disabled by default, but can be enabled in prj.conf if required.
  • UART1 is enabled by default, but suspended in startup.
  • overlay-trace-backend-uart.conf only includes AT#XTRACE.
  • overlay-trace-backend-uart.overlay is removed.

Jira: SM-296, SM-332

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR switches the Serial Modem application’s default logging backend from SEGGER RTT to UART1 (VCOM1 on nRF9151 DK), with the UART kept suspended until logs are enabled at runtime via AT#XLOG=1. It also separates UART logging from the modem trace backend so that AT#XLOG is always present, while AT#XTRACE remains opt-in via an overlay.

Changes:

  • Default app logging moved to UART1 with CONFIG_LOG_BACKEND_UART_AUTOSTART=n and runtime enable/disable via AT#XLOG.
  • Modem trace backend (AT#XTRACE) kept behind overlay-trace-backend-uart.conf; the devicetree overlay for selecting/configuring UART1 was removed and equivalent settings were moved into board overlays.
  • Documentation and migration notes updated to reflect the new default logging behavior and how to re-enable RTT.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
doc/releases/migration_notes_v2.0.0.rst Adds a required migration note about the default log backend moving to UART and runtime enable via AT#XLOG=1.
doc/releases/migration_notes_ncs_slm_v3.1.x.rst Adds the same migration note for users migrating from NCS SLM v3.1.x.
doc/links.txt Adds a new link target for nRF9151 anomaly 36 (used by the updated logging docs).
doc/app/sm_logging.rst Updates logging documentation: UART1 default, RTT re-enable instructions, and adds anomaly note.
doc/app/at_trace.rst Updates prerequisites: AT#XLOG always available; AT#XTRACE requires the Kconfig overlay only.
app/src/sm_trace_backend_uart.c Refactors UART device naming/handling; removes XLOG handling from this file; adds startup suspend via SYS_INIT.
app/src/sm_log_uart.c New module implementing AT#XLOG and suspending/resuming the console UART to control UART log backend at runtime.
app/sample.yaml Removes the deleted trace devicetree overlay from CI build args.
app/prj.conf Switches defaults to UART logging (autostart off) and disables RTT by default.
app/overlay-trace-backend-uart.overlay Removed; trace backend no longer relies on this overlay for routing/configuring zephyr,console.
app/overlay-trace-backend-uart.conf Now only enables the UART modem trace backend (AT#XTRACE) and forces modem trace level off at boot.
app/CMakeLists.txt Adds the new sm_log_uart.c source file to the build.
app/boards/thingy91x_nrf9151_ns.overlay Routes zephyr,console to uart1 and configures UART1 at 1,000,000 baud.
app/boards/nrf9151dk_nrf9151_ns.overlay Routes zephyr,console to uart1 and configures UART1 at 1,000,000 baud.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread doc/links.txt Outdated
Comment thread doc/app/sm_logging.rst Outdated
Comment thread app/src/sm_log.c
Comment on lines +129 to +135
if (!IS_ENABLED(CONFIG_LOG_BACKEND_UART) ||
!IS_ENABLED(CONFIG_LOG_BACKEND_UART_AUTOSTART)) {
/* Start with UART log backend disabled. */
if (uart_suspend()) {
LOG_ERR("Failed to suspend UART log backend");
sm_init_failed = true;
return -EFAULT;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended. If customer changes to RTT-traces, they do not need to disable the UART from the DTS, although they are free to do so.

Comment thread app/src/sm_trace_backend_uart.c
Comment thread app/prj.conf Outdated
Comment thread doc/releases/migration_notes_ncs_slm_v3.1.x.rst Outdated
Comment thread doc/releases/migration_notes_v2.0.0.rst
Comment thread app/src/sm_log.c
@MarkusLassila MarkusLassila force-pushed the default-uart-tracing branch from 942842b to dc24e04 Compare May 7, 2026 07:42
Comment thread doc/app/sm_logging.rst Outdated
Comment on lines +54 to +56
`nRF9151 anomaly 36`_ causes debug port to be locked when the application reaches low power state (<3 uA current consumption).
This takes place when DTR is deasserted and RTT client, such as J-Link RTT Viewer, is not connected.
Since the RTT backend relies on the debug port, the RTT client must be connected before the application enters low power state to avoid this issue.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`nRF9151 anomaly 36`_ causes debug port to be locked when the application reaches low power state (<3 uA current consumption).
This takes place when DTR is deasserted and RTT client, such as J-Link RTT Viewer, is not connected.
Since the RTT backend relies on the debug port, the RTT client must be connected before the application enters low power state to avoid this issue.
`nRF9151 anomaly 36`_ locks the debug port when the application reaches a low power state (<3 uA current consumption).
This takes place when DTR is deasserted and the RTT client, such as J-Link RTT Viewer, is not connected.
Since the RTT backend relies on the debug port, the RTT client must be connected before the application enters a low power state to avoid this issue.

- Application logs are by default going to UART1, when the AT#XLOG=1
is given.

- RTT application logs are disabled by default, but can be enabled in
prj.conf if required.

- UART1 is enabled by default, but suspended in startup.

- overlay-trace-backend-uart.conf only includes AT#XTRACE.

- overlay-trace-backend-uart.overlay is removed.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
@MarkusLassila MarkusLassila force-pushed the default-uart-tracing branch from dc24e04 to ca8639a Compare May 7, 2026 08:14
@MarkusLassila MarkusLassila merged commit 46f9a0a into nrfconnect:main May 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants