Skip to content

Commit

Permalink
snippets: add new snippet for uart based modem trace
Browse files Browse the repository at this point in the history
Add new snippet 'nrf9x-modem-trace-uart'. The new snippet can be
used to enable modem tracing over uart for either nrf91 or nrf92
application. It works similar to snippet 'nrf91-modem-trace-uart'.

The 'nrf91-modem-trace-uart' snippet is kept for backwards
compatibility.

Signed-off-by: Andreas Moltumyr <[email protected]>
  • Loading branch information
anhmolt committed Feb 4, 2025
1 parent 35c3289 commit 47a004c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 0 deletions.
14 changes: 14 additions & 0 deletions snippets/nrf9x-modem-trace-uart/modem-trace-uart-common.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_NRF_MODEM_LIB_TRACE=y

# Modem trace uart backend
CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_UART=y

# UART configuration (common)
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
12 changes: 12 additions & 0 deletions snippets/nrf9x-modem-trace-uart/modem-trace-uart-nrf91.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# UART configuration (nRF91 specific)
CONFIG_UART_1_ASYNC=y
CONFIG_UART_1_INTERRUPT_DRIVEN=n

# Power management
CONFIG_PM_DEVICE=y
17 changes: 17 additions & 0 deletions snippets/nrf9x-modem-trace-uart/modem-trace-uart-nrf91.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Enable uart1 for tracing. */
&uart1 {
status = "okay";
current-speed = < 1000000 >;
};

/ {
chosen {
nordic,modem-trace-uart = &uart1;
};
};
9 changes: 9 additions & 0 deletions snippets/nrf9x-modem-trace-uart/modem-trace-uart-nrf92.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# UART configuration (nRF92 specific)
CONFIG_UART_135_ASYNC=y
CONFIG_UART_135_INTERRUPT_DRIVEN=n
41 changes: 41 additions & 0 deletions snippets/nrf9x-modem-trace-uart/modem-trace-uart-nrf92.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Enable uart135 for tracing. */
&uart135 {
status = "okay";
current-speed = < 1000000 >;
memory-regions = < &modem_trace_dma_region >;
};

/ {
chosen {
nordic,modem-trace-uart = &uart135;
};

reserved-memory {
/* Add memory region for tracing UART. */
modem_trace_dma_region: memory@2fc06800 {
compatible = "nordic,owned-memory", "zephyr,memory-region";
reg = <0x2fc06800 DT_SIZE_K(2)>;
status = "okay";
#memory-region-cells = <0>;
nordic,access = <NRF_OWNER_ID_APPLICATION NRF_PERM_RW>;
zephyr,memory-region = "DMA_RAM3x_MODEM_TRACE";
zephyr,memory-attr = <( DT_MEM_DMA )>;
};
};
};

/* Reduce size to make room for modem trace dma region. */
&cpuapp_dma_region {
reg = <0x2fc06000 DT_SIZE_K(2)>;
};

/* Enable the trace signal on the application bellboard. */
&cpuapp_bellboard {
nordic,interrupt-mapping = <0xE3042041 0>;
};
13 changes: 13 additions & 0 deletions snippets/nrf9x-modem-trace-uart/snippet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: nrf9x-modem-trace-uart
append:
EXTRA_CONF_FILE: modem-trace-uart-common.conf

boards:
/.*/nrf91[0-9][0-9]/ns/:
append:
EXTRA_DTC_OVERLAY_FILE: modem-trace-uart-nrf91.overlay
EXTRA_CONF_FILE: modem-trace-uart-nrf91.conf
/.*/nrf92[0-9][0-9]/cpuapp/:
append:
EXTRA_DTC_OVERLAY_FILE: modem-trace-uart-nrf92.overlay
EXTRA_CONF_FILE: modem-trace-uart-nrf92.conf

0 comments on commit 47a004c

Please sign in to comment.