From a110bcbad6370e756f7ef9bf596776805a279901 Mon Sep 17 00:00:00 2001 From: Nordic Builder Date: Mon, 11 Aug 2025 09:03:28 +0000 Subject: [PATCH 01/10] manifest: Update sdk-zephyr revision (auto-manifest PR) Automatically created by Github Action Signed-off-by: Nordic Builder --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 899b3decc5e0..a5d871d56e29 100644 --- a/west.yml +++ b/west.yml @@ -65,7 +65,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: c1bf4336ce6d3a1bf6007c06c9ed8142183e16d1 + revision: 59e68646df7213ce3e782f781fdb872cfdc42f7d import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From 262259f118149dd1068f6fb5729220b9fe193053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Fri, 22 Aug 2025 11:26:52 +0200 Subject: [PATCH 02/10] maniefest: update sdk-zephyr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit soft off tests Signed-off-by: Łukasz Stępnicki --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a5d871d56e29..f57e4f0343b0 100644 --- a/west.yml +++ b/west.yml @@ -65,7 +65,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 59e68646df7213ce3e782f781fdb872cfdc42f7d + revision: pull/3221/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From d38be4294c347571c5e68b91c8ae57d9e095872c Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Thu, 10 Apr 2025 13:54:04 +0200 Subject: [PATCH 03/10] lib: ppr_prl: PPR power logger lib Library to start and control the PPR power logger. Signed-off-by: Karsten Koenig --- include/ppr_prl.h | 16 ++++++ lib/CMakeLists.txt | 1 + lib/Kconfig | 1 + lib/ppr_prl/CMakeLists.txt | 8 +++ lib/ppr_prl/Kconfig | 40 +++++++++++++++ lib/ppr_prl/ppr_prl.c | 49 +++++++++++++++++++ snippets/haltium_ppr_power_logger/README.rst | 11 +++++ .../boards/nrf54h20_cpuapp.overlay | 31 ++++++++++++ .../ppr_power_logger.conf | 1 + snippets/haltium_ppr_power_logger/snippet.yml | 12 +++++ 10 files changed, 170 insertions(+) create mode 100644 include/ppr_prl.h create mode 100644 lib/ppr_prl/CMakeLists.txt create mode 100644 lib/ppr_prl/Kconfig create mode 100644 lib/ppr_prl/ppr_prl.c create mode 100644 snippets/haltium_ppr_power_logger/README.rst create mode 100644 snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay create mode 100644 snippets/haltium_ppr_power_logger/ppr_power_logger.conf create mode 100644 snippets/haltium_ppr_power_logger/snippet.yml diff --git a/include/ppr_prl.h b/include/ppr_prl.h new file mode 100644 index 000000000000..91d6f6e093b8 --- /dev/null +++ b/include/ppr_prl.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#ifndef PPR_PRL_H_ +#define PPR_PRL_H_ + +#include + +void ppr_prl_configure(uint32_t max_samples, uint32_t vtim_cnttop); + +void ppr_prl_start(void); + +#endif /* PPR_PRL_H_ */ \ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 705274168ab0..dd18445e1cc5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -52,3 +52,4 @@ add_subdirectory_ifdef(CONFIG_FEM_AL_LIB fem_al) add_subdirectory_ifdef(CONFIG_SAMPLE_RATE_CONVERTER sample_rate_converter) add_subdirectory_ifdef(CONFIG_NCS_BOOT_BANNER boot_banner) add_subdirectory_ifdef(CONFIG_UICC_LWM2M uicc_lwm2m) +add_subdirectory_ifdef(CONFIG_PPR_PRL ppr_prl) diff --git a/lib/Kconfig b/lib/Kconfig index 4f068905ef94..a922f9c198ba 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -53,5 +53,6 @@ rsource "fem_al/Kconfig" rsource "sample_rate_converter/Kconfig" rsource "boot_banner/Kconfig" rsource "uicc_lwm2m/Kconfig" +rsource "ppr_prl/Kconfig" endmenu diff --git a/lib/ppr_prl/CMakeLists.txt b/lib/ppr_prl/CMakeLists.txt new file mode 100644 index 000000000000..30a1156f8da9 --- /dev/null +++ b/lib/ppr_prl/CMakeLists.txt @@ -0,0 +1,8 @@ +# +# Copyright (c) 2021 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +zephyr_library() +zephyr_library_sources(ppr_prl.c) diff --git a/lib/ppr_prl/Kconfig b/lib/ppr_prl/Kconfig new file mode 100644 index 000000000000..332aec56b086 --- /dev/null +++ b/lib/ppr_prl/Kconfig @@ -0,0 +1,40 @@ +# +#Copyright(c) 2025 Nordic Semiconductor ASA +# +#SPDX - License - Identifier : LicenseRef - Nordic - 5 - Clause +# + +menuconfig PPR_PRL + bool "PPR power request logger library" + help + This library provides communication with the PPR power request logger. + + +if PPR_PRL + +config PPR_PRL_AUTO_START + bool "Auto start PPR PRL" + default y + help + If selected, the PPR power logger will be started automatically + when the application starts. Otherwise, the application must + call ppr_prl_start() to start the logger. + +if PPR_PRL_AUTO_START + +config PPR_PRL_AUTO_START_CONFIG_VTIM_CNTTOP + int "VTIM_CNTTOP value" + default 16000 + help + The value of the VTIM_CNTTOP register for the PPR power request logger sampling timer. + The TIMER runs at 16 MHz and the value is the number of clock cycles to count before taking a sample. + +config PPR_PRL_AUTO_START_CONFIG_MAX_SAMPLES + int "Number of samples the power logger should collect" + default 1024 + help + The number of samples the power logger should collect before stopping. + +endif # PPR_PRL_AUTO_START + +endif # PPR_PRL \ No newline at end of file diff --git a/lib/ppr_prl/ppr_prl.c b/lib/ppr_prl/ppr_prl.c new file mode 100644 index 000000000000..27c5fdd8949e --- /dev/null +++ b/lib/ppr_prl/ppr_prl.c @@ -0,0 +1,49 @@ +#include "ppr_prl.h" + +#include +#include +#include + + +#define PPR_LOAD_CONFIG_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908030UL) +#define PPR_START_SAMPLING_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908034UL) +#define STATE_PPR_PRL_READY 0x01 + +typedef struct { + uint32_t vtim_cnttop; + uint8_t state; + uint8_t rfu; + uint16_t max_samples; +} log_conf_t; + +/* log_conf inside the ppr ram, just writing straight to that */ +static log_conf_t *log_conf = (log_conf_t*)((uint32_t)(0x2fc00ff8)); + +void ppr_prl_configure(uint32_t max_samples, uint32_t vtim_cnttop) { + log_conf->vtim_cnttop = vtim_cnttop; + log_conf->max_samples = max_samples; + log_conf->rfu = 0; + sys_cache_data_flush_range(log_conf, sizeof(*log_conf)); + + PPR_LOAD_CONFIG_TASKS_TRIGGER = 1ul; + + while (log_conf->state != STATE_PPR_PRL_READY) { + sys_cache_data_flush_and_invd_range(log_conf, sizeof(*log_conf)); + } +} + +void ppr_prl_start(void) { + PPR_START_SAMPLING_TASKS_TRIGGER = 1ul; +} + +#if CONFIG_PPR_PRL_AUTO_START + +static int ppr_prl_auto_start(void) { + ppr_prl_configure(CONFIG_PPR_PRL_AUTO_START_CONFIG_MAX_SAMPLES, CONFIG_PPR_PRL_AUTO_START_CONFIG_VTIM_CNTTOP); + ppr_prl_start(); + return 0; +} + +SYS_INIT(ppr_prl_auto_start, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +#endif diff --git a/snippets/haltium_ppr_power_logger/README.rst b/snippets/haltium_ppr_power_logger/README.rst new file mode 100644 index 000000000000..33aec8ed1da8 --- /dev/null +++ b/snippets/haltium_ppr_power_logger/README.rst @@ -0,0 +1,11 @@ +.. _haltium-ppr-power-logger: + +Haltium PPR power logger +###################################################### + +Overview +******** + +TODO: Write something nice. + +* Add some magic to flash the prebuilt hex \ No newline at end of file diff --git a/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..de4fff77f6a8 --- /dev/null +++ b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/* Remove IPC to PPR and reconfigure PPR memory */ +/delete-node/ &{/ipc/ipc-2-13}; +/delete-node/ &cpuppr_ram3x_region; +/{ + reserved-memory { + + cpuppr_ram3x_region: memory@2fc00000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc00000 DT_SIZE_K(64)>; + status = "okay"; + nordic,access = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2fc00000 0x10000>; + + cpuppr_code_data: memory@0 { + reg = <0x0 DT_SIZE_K(64)>; + }; + }; + }; +}; + +&cpuppr_vpr { + status = "okay"; +}; diff --git a/snippets/haltium_ppr_power_logger/ppr_power_logger.conf b/snippets/haltium_ppr_power_logger/ppr_power_logger.conf new file mode 100644 index 000000000000..2bf8f7c7302d --- /dev/null +++ b/snippets/haltium_ppr_power_logger/ppr_power_logger.conf @@ -0,0 +1 @@ +CONFIG_PPR_PRL=y diff --git a/snippets/haltium_ppr_power_logger/snippet.yml b/snippets/haltium_ppr_power_logger/snippet.yml new file mode 100644 index 000000000000..ecf0ec199d06 --- /dev/null +++ b/snippets/haltium_ppr_power_logger/snippet.yml @@ -0,0 +1,12 @@ +# +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +name: haltium-ppr-power-logger +boards: + /.*/nrf54h20/cpuapp/: + append: + EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay + EXTRA_CONF_FILE: ppr_power_logger.conf From 0821e160e1563a07c1b3b2ee13235c0c24b687f0 Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Tue, 29 Apr 2025 12:58:31 +0200 Subject: [PATCH 04/10] samples: bluetooth: peripheral_rscs: Add PPR PRL Added ppr power logger variant of the sample to log the different power requests etc with ble connections. Signed-off-by: Karsten Koenig --- samples/bluetooth/peripheral_rscs/sample.yaml | 22 +++++++++++-------- samples/bluetooth/peripheral_rscs/src/main.c | 19 ++++++++++++++++ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/samples/bluetooth/peripheral_rscs/sample.yaml b/samples/bluetooth/peripheral_rscs/sample.yaml index 7c50cbcf60aa..3d199c0fbacb 100644 --- a/samples/bluetooth/peripheral_rscs/sample.yaml +++ b/samples/bluetooth/peripheral_rscs/sample.yaml @@ -32,12 +32,16 @@ tests: - bluetooth - ci_build - sysbuild - harness: console - harness_config: - type: multi_line - ordered: true - regex: - - "Starting Running Speed and Cadence peripheral sample" - - "Bluetooth initialized" - - "Advertising successfully started" - timeout: 15 + + + sample.bluetooth.peripheral_rscs.ppr_prl: + sysbuild: true + build_only: true + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + required_snippets: + - haltium-ppr-power-logger + extra_configs: + - CONFIG_PPR_PRL_AUTO_START=n diff --git a/samples/bluetooth/peripheral_rscs/src/main.c b/samples/bluetooth/peripheral_rscs/src/main.c index 310d79abf6c0..70788649acce 100644 --- a/samples/bluetooth/peripheral_rscs/src/main.c +++ b/samples/bluetooth/peripheral_rscs/src/main.c @@ -24,6 +24,13 @@ #include +#ifdef CONFIG_PPR_PRL +#include + +static bool start_ppr_prl = false; +#endif + + #define RUN_STATUS_LED DK_LED1 #define CON_STATUS_LED DK_LED2 #define RUN_LED_BLINK_INTERVAL 1000 @@ -110,6 +117,9 @@ void evt_handler(enum bt_rscs_evt evt) switch (evt) { case RSCS_EVT_MEAS_NOTIFY_ENABLE: printk("Measurement notify enable\n"); +#ifdef CONFIG_PPR_PRL + start_ppr_prl = true; +#endif break; case RSCS_EVT_MEAS_NOTIFY_DISABLE: printk("Measurement notify disable\n"); @@ -320,6 +330,15 @@ int main(void) k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL)); rsc_simulation(&measurement); + +#ifdef CONFIG_PPR_PRL + if (start_ppr_prl) { + ppr_prl_configure(1536, 800); + ppr_prl_start(); + start_ppr_prl = false; + } +#endif + bt_rscs_measurement_send(current_conn, &measurement); } } From 7ab0d3bbb531edc9635d5562e399fb0de808e44c Mon Sep 17 00:00:00 2001 From: Karsten Koenig Date: Fri, 6 Jun 2025 12:23:12 +0200 Subject: [PATCH 05/10] ppr_prl: Update for v1 of the logger Added the v1 logger version, that includes pin toggling via the VPR GPIO feature so also assigned over two pins in the overlay. Bundles everything more into the snippet to be more out-of-the-box usable. Signed-off-by: Karsten Koenig --- lib/ppr_prl/ppr_prl.c | 2 +- scripts/west-commands.yml | 5 + scripts/west_commands/ppr_prl.py | 184 ++++++++++++++++++ .../boards/nrf54h20_cpuapp.overlay | 11 ++ .../ppr_hex/firmware_nvm_v1.hex | 111 +++++++++++ 5 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 scripts/west_commands/ppr_prl.py create mode 100644 snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex diff --git a/lib/ppr_prl/ppr_prl.c b/lib/ppr_prl/ppr_prl.c index 27c5fdd8949e..8143a95492ac 100644 --- a/lib/ppr_prl/ppr_prl.c +++ b/lib/ppr_prl/ppr_prl.c @@ -17,7 +17,7 @@ typedef struct { } log_conf_t; /* log_conf inside the ppr ram, just writing straight to that */ -static log_conf_t *log_conf = (log_conf_t*)((uint32_t)(0x2fc00ff8)); +static log_conf_t *log_conf = (log_conf_t*)((uint32_t)(0x2fc007f8)); void ppr_prl_configure(uint32_t max_samples, uint32_t vtim_cnttop) { log_conf->vtim_cnttop = vtim_cnttop; diff --git a/scripts/west-commands.yml b/scripts/west-commands.yml index 33f0bc214573..7c40acfda37e 100644 --- a/scripts/west-commands.yml +++ b/scripts/west-commands.yml @@ -44,3 +44,8 @@ west-commands: - name: ncs-ironside-se-update class: NcsIronSideSEUpdate help: IronSide SE update utility + - file: scripts/west_commands/ppr_prl.py + commands: + - name: ppr-prl + class: PPR_PRL + help: PPR power request logger utility diff --git a/scripts/west_commands/ppr_prl.py b/scripts/west_commands/ppr_prl.py new file mode 100644 index 000000000000..4f0e0b8ce794 --- /dev/null +++ b/scripts/west_commands/ppr_prl.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python3 +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +import argparse +import json +import struct +import subprocess +import sys +import tempfile +import textwrap +from dataclasses import asdict, dataclass +from pathlib import Path +from typing import Any + +import yaml +from west.commands import WestCommand + +nrf_path = "/" + +header_size = 32 +entry_size = 12 + + +class NrfutilWrapperFlash: + def __init__( + self, + image_path: str, + device_id: str | None = None, + ) -> None: + self.device_id = device_id + self.image_path = image_path + + def run_command(self): + command = self._build_command() + print(" ".join(command), file=sys.stderr) + result = subprocess.run(command, stderr=subprocess.PIPE, text=True) + if result.returncode: + print(result.stderr, file=sys.stderr) + sys.exit("Flashing failed!") + else: + print("Flashed!", file=sys.stderr) + + + def _build_command(self) -> list[str]: + command = [ + "nrfutil", + "device", + "program", + "--options", + "chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE", + "--core", + "Application", + ] + command += ["--firmware", self.image_path] + + if self.device_id: + command += ["--serial-number", self.device_id] + else: + command += ["--traits", "jlink"] + + return command + + +class NrfutilWrapperReadout: + def __init__( + self, + address: str, + entries_count: int, + output_path: str, + device_id: str | None = None, + ) -> None: + self.address = address + self.entries_count = entries_count + self.output_path = output_path + self.device_id = device_id + + def run_command(self): + command = self._build_command() + print(" ".join(command), file=sys.stderr) + result = subprocess.run(command, capture_output=True, text=True) + if result.returncode: + print(result.stderr, file=sys.stderr) + sys.exit("Readout failed!") + else: + try: + with open(self.output_path, "xb") as output_file: + self._convert_memrd2bin(result.stdout, output_file) + print("Read out the log!", file=sys.stderr) + except FileExistsError: + print(f"Error: The file '{self.output_path}' already exists. Operation aborted.") + + + def _convert_memrd2bin(self, infile, outfile): + lines = infile.splitlines() + for line in lines: + entries = line.split(" ") + entries = entries[1:5] + print(entries) + for hex_string in entries: + h = int(hex_string, 16) + b = struct.pack(' list[str]: + command = [ + "nrfutil", + "device", + "x-read", + "--width", + "32", + "--core", + "Application", + ] + command += ["--address", self.address] + command += ["--bytes", "{}".format(self.entries_count * entry_size + header_size)] + + if self.device_id: + command += ["--serial-number", self.device_id] + else: + command += ["--traits", "jlink"] + + return command + + +class PPR_PRL(WestCommand): + def __init__(self): + super().__init__( + name="ppr-prl", + help="PPR power request logger", + description="utility wrappers for ppr power request logger", + ) + + def do_add_parser(self, parser_adder): + parser = parser_adder.add_parser( + self.name, help=self.help, description=self.description + ) + + subparsers = parser.add_subparsers(dest="command") + flash_parser = subparsers.add_parser( + "flash", + help="Flash the ppr power logger NVM image", + formatter_class=argparse.RawDescriptionHelpFormatter + ) + flash_parser.add_argument("-i", "--image", metavar="PATH", help="Path to NVM image to flash") + flash_parser.add_argument("--dev-id", help="Device serial number") + + readout_parser = subparsers.add_parser( + "readout", + help="Dump the ppr power logger log file", + formatter_class=argparse.RawDescriptionHelpFormatter + ) + readout_parser.add_argument("-o", "--output", metavar="PATH", help="Path to the output file", required=True) + readout_parser.add_argument("--dev-id", help="Device serial number") + readout_parser.add_argument("--address", help="Starting address of the log buffer to dump", default="0x2fc007e0") + readout_parser.add_argument("--entries-count", help="Number of log entries", type=int, default=1024) + + return parser + + def do_run(self, args, unknown_args): + if args.command == "flash": + self._flash(args) + if args.command == "readout": + self._readout(args) + + + def _flash(self, args: argparse.Namespace) -> None: + if not args.image: + nrf_path = self.manifest.topdir + "/nrf" + image_path = "{}/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex".format(nrf_path) + else: + image_path = args.image + + runner = NrfutilWrapperFlash( + device_id=args.dev_id, image_path=image_path + ) + runner.run_command() + + def _readout(self, args: argparse.Namespace) -> None: + runner = NrfutilWrapperReadout( + device_id=args.dev_id, address=args.address, entries_count = args.entries_count, output_path = args.output + ) + runner.run_command() diff --git a/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay index de4fff77f6a8..38aa9465ba86 100644 --- a/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay +++ b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay @@ -26,6 +26,17 @@ }; }; +&pinctrl { + ppr_default: ppr_default { + group1 { + psels = , + ; + }; + }; +}; + &cpuppr_vpr { status = "okay"; + pinctrl-0 = <&ppr_default>; + pinctrl-names = "default"; }; diff --git a/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex b/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex new file mode 100644 index 000000000000..494df752c13d --- /dev/null +++ b/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex @@ -0,0 +1,111 @@ +:020000040E0EDE +:1040000097110000938101F21381018C33040100A8 +:10401000970200009382020F7390723097020000A3 +:104020009382A26473905230731020349702000080 +:104030009382426F170300001303C36E97030000BF +:10404000938303693D28970200009382A26D138336 +:10405000C180970300009383A36725209382C180CA +:104060001383C180970300009383436719289382C9 +:10407000C1801383C18097030000938323661120BE +:1040800021A8638A620003A5030023A0A200910275 +:104090009103E39A62FE82809382C1801383C18080 +:1040A00021289382C1801383818139209382818169 +:1040B00013838181112009A86387620023A0020075 +:1040C0009102E39D62FE8280EF00805900000000B3 +:1040D00000000000000000000000000000000000E0 +:1040E00000000000000000000000000000000000D0 +:1040F00000000000000000000000000000000000C0 +:104100006E06C02F7006C02F7206C02F0000000080 +:104110007406C02F7606C02F000000007806C02F5E +:104120007A06C02F7C06C02F000000007E06C02F3C +:104130008006C02F0000000000000000000000000A +:104140008206C02F8206C02F8206C02F8206C02F93 +:104150008206C02F8206C02F8206C02F8206C02F83 +:104160008206C02F8206C02F8206C02F8206C02F73 +:104170000002C02F8A02C02F8206C02F8206C02FE5 +:104180002805C02F00000000000000000000000013 +:10419000000000000000000000000000000000001F +:1041A000000000000000000000000000000000000F +:1041B00000000000000000000000000000000000FF +:0241C0000000FD +:0E41F00073002030130000006F00E046000056 +:10420000856773B0077EB706C02F83A70672D843B1 +:104210002183058B01CF0547A388E180735000BC43 +:104220009307F00F739017BC83A70672D8432183BE +:10423000098B01C785462388D180D843418319C79C +:10424000D84383D641814183636CD7029843C146EA +:1042500063F7E600B706C02F83A6467298C6D84318 +:10426000C1769386F60F42074183D8C3D843758F32 +:10427000D8C3D843137707F013671700D8C38280D9 +:10428000D84341832399E180D1B7B71700F0985BF9 +:104290003706C02F89661377F7EF98DBD85B137763 +:1042A000F7EFD8DB032706725C4393F707F093E739 +:1042B00037005CC373B0067E7350017D73D0117DEF +:1042C0007350207DB707C02F83A747729C47739018 +:1042D000377D73D0207D828083D7E180311122C861 +:1042E00026C66385071EB707C02F3EC483D7E1806B +:1042F0003707C02F832587723707945F83260752BD +:1043000092073385F50014C1B736945F832747526F +:1043100003A70660B715965FBD8B1207D98F2AC019 +:104320005CC1B726965F03A7054083A3454083A2DF +:10433000854B03A4C54B03A3054C83A4064083A56A +:104340004640B747965F0D8B2EC203A5464983A50D +:10435000074083A6474083A7C7488A0393F3C30057 +:10436000F2075D8F856722049202938707F093F22C +:10437000F20F33677700E18F32031244336757003F +:10438000420393920401D98F1353030137070300AB +:1043900033E3670093132401B3F7E20037070C00FF +:1043A000B3F3E300B367F3003707F0005205798DEC +:1043B000B3E7770037040003E205C98FE18D0245BA +:1043C000B703000CEA06CD8FB3F67600D58F1CC577 +:1043D000B737965F83A4074003A7474083A7074AE0 +:1043E000B755965F83A605400A0783A2454092070A +:1043F00083A5054993F7F70F3755955F318B032355 +:1044000005408D885D8FA206856703254540458F51 +:10441000AA02B20593F60630B7D4965F938707C019 +:10442000D98E83A40440B3F7F200C2053777955FB5 +:1044300003270740C1814203D58FB782955FB70636 +:104440001F00CD8F5605B376D300B705600003A3D8 +:104450000240DD8EE98DDE0437058000B3E7B6004B +:10446000E98C6207618F0245C58F6A03D98F337368 +:10447000730003C70181B3E767005CC51DC303D7A1 +:10448000E18093074006630AF70603D7E1809307AC +:10449000800C630FF70603D7E1809307C01263090E +:1044A000F70483D7E1802247C17585070327477248 +:1044B000C207C1832397F18083D6E1805C47ED8FEB +:1044C000D58F5CC74244B24451018280B707C02FE8 +:1044D0003EC483A747727370043037C7995F0325C2 +:1044E000077A8325477A7360043088C3CCC3FDBB49 +:1044F000B767085F23A007406DB7B767085F054738 +:1045000023A0E74003D7E1809307800CE315F7F879 +:10451000B767085F0D4723A0E74003D7E180930703 +:10452000C012E310F7F8E9B7C16773B0077E03D78D +:10453000E18083D721816362F70403C7C18005C787 +:10454000B707C02F83A6077283C71181DC423717D4 +:1045500000F093F707F093E74700DCC23C4393F782 +:10456000F7EF3CC382807350007D7350107D735011 +:10457000207D05472386E1808280711106C0930764 +:10458000F00F739007BC893B735000BC824011014F +:104590008280C167938707809183C207C1833707F1 +:1045A0007D50239AF18093071704F3A7077C73606B +:1045B0000430B7C7995F03A7877A1367170023A44E +:1045C000E77A03A7077A0F00A00A03A7477A0F002C +:1045D000A00A93161700E3C606FEB707C02F03A76D +:1045E0000772B707C02F83A7477223200700014532 +:1045F00088C381451167CCC3130707E898C7D8471C +:10460000C176758FD8C783D64181371700F0C206AF +:10461000C1822399D18003D64181D4474206C20684 +:10462000C182D18ED4C7944B93F606F093E6160060 +:1046300094CB944B93F6F60F94CB23AA07003C43FC +:1046400093E707103CC31C5B93E707101CDB5C5B24 +:1046500093E707105CDB7300501073005010E5BF48 +:10466000711106C03D37010001000100EDBF01A03E +:1046700001A001A001A001A001A001A001A001A032 +:1046800001A001A0CC06C02F2007C02F0000000011 +:10469000CC06C02F2007C02F03000000D806C02F73 +:1046A0002C07C02F00000000D806C02F2C07C02FF9 +:1046B000000000002C07C02F000000002C07C02FB6 +:1046C000030000003807C02F00000000F807C02FCB +:0846D000E007C02F0008C02F15 +:040000050E0E40009B +:00000001FF From fd28fbde737964e8956ea7dfc966b5f16c8d5872 Mon Sep 17 00:00:00 2001 From: Maciej Meijer Date: Thu, 10 Jul 2025 13:26:19 +0200 Subject: [PATCH 06/10] dts: adaption to iron cpuppr_ram3x_region section has been renamed to cpuppr_code_data Signed-off-by: Maciej Meijer --- .../boards/nrf54h20_cpuapp.overlay | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay index 38aa9465ba86..b5b57cac8883 100644 --- a/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay +++ b/snippets/haltium_ppr_power_logger/boards/nrf54h20_cpuapp.overlay @@ -6,22 +6,18 @@ /* Remove IPC to PPR and reconfigure PPR memory */ /delete-node/ &{/ipc/ipc-2-13}; -/delete-node/ &cpuppr_ram3x_region; +/delete-node/ &cpuppr_code_data; /{ reserved-memory { - cpuppr_ram3x_region: memory@2fc00000 { + cpuppr_code_data: memory@2fc00000 { compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(64)>; status = "okay"; - nordic,access = ; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2fc00000 0x10000>; - - cpuppr_code_data: memory@0 { - reg = <0x0 DT_SIZE_K(64)>; - }; }; }; }; From 8c2c2744928ebfb1c72214fad84479edf800ffd9 Mon Sep 17 00:00:00 2001 From: Maciej Meijer Date: Mon, 28 Jul 2025 11:57:22 +0200 Subject: [PATCH 07/10] west: add --direction option for reading memory Signed-off-by: Maciej Meijer --- scripts/west_commands/ppr_prl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/west_commands/ppr_prl.py b/scripts/west_commands/ppr_prl.py index 4f0e0b8ce794..a421b163099d 100644 --- a/scripts/west_commands/ppr_prl.py +++ b/scripts/west_commands/ppr_prl.py @@ -112,6 +112,7 @@ def _build_command(self) -> list[str]: "32", "--core", "Application", + "--direct", ] command += ["--address", self.address] command += ["--bytes", "{}".format(self.entries_count * entry_size + header_size)] From eeef9fa71686251da865db2da9a1ba7deb5f69b4 Mon Sep 17 00:00:00 2001 From: Maciej Meijer Date: Mon, 28 Jul 2025 14:23:28 +0200 Subject: [PATCH 08/10] west: add new ppr firmware Add new ppr hex file and set it as default to be flashed. Signed-off-by: Maciej Meijer --- scripts/west_commands/ppr_prl.py | 2 +- .../ppr_hex/firmware_nvm_v2.hex | 196 ++++++++++++++++++ 2 files changed, 197 insertions(+), 1 deletion(-) create mode 100755 snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex diff --git a/scripts/west_commands/ppr_prl.py b/scripts/west_commands/ppr_prl.py index a421b163099d..bf15eb1c8d50 100644 --- a/scripts/west_commands/ppr_prl.py +++ b/scripts/west_commands/ppr_prl.py @@ -169,7 +169,7 @@ def do_run(self, args, unknown_args): def _flash(self, args: argparse.Namespace) -> None: if not args.image: nrf_path = self.manifest.topdir + "/nrf" - image_path = "{}/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v1.hex".format(nrf_path) + image_path = "{}/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex".format(nrf_path) else: image_path = args.image diff --git a/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex b/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex new file mode 100755 index 000000000000..b07075b4eb62 --- /dev/null +++ b/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex @@ -0,0 +1,196 @@ +:020000040E0EDE +:1040000097110000938101611381019D3304010028 +:10401000970200009382021F739072309712000083 +:1040200093822299739052307310203497120000BB +:10403000938242DE171300001303C3DD97130000C1 +:10404000938383CB8928971200009382A2DC1713F5 +:1040500000001303E3DC971300009383E3C92528D2 +:10406000971200009382C2DB17130000130343DB97 +:1040700097130000938303C9392897120000938295 +:1040800022DA171300001303A3D9971300009383B8 +:1040900063C7112021A8638A620003A5030023A03F +:1040A000A20091029103E39A62FE828097120000BF +:1040B000938202D713830187212893820187138378 +:1040C000C18739209382C1871383C187112009A832 +:1040D0006387620023A002009102E39D62FE82805A +:0840E000EF00B03CEF00500CB2 +:0E41F00073002030130000006F00607B0000A1 +:10420000940CC02F960CC02F980CC02F00000000FB +:104210009A0CC02F9C0CC02F000000009E0CC02FD9 +:10422000A00CC02FA20CC02F00000000A40CC02FB7 +:10423000A60CC02F000000000000000000000000DD +:10424000A80CC02FA80CC02FA80CC02FA80CC02FE2 +:10425000A80CC02FA80CC02FA80CC02FA80CC02FD2 +:10426000A80CC02FA80CC02FA80CC02FA80CC02FC2 +:104270002404C02FB804C02FA80CC02FA80CC02F36 +:10428000B008C02F00000000000000000000000087 +:10429000000000000000000000000000000000001E +:1042A000000000000000000000000000000000000E +:1042B00000000000000000000000000000000000FE +:0242C0000000FC +:1042C4000D0A48656C6C6F20576F726C64206672BF +:1042D4006F6D20505052202D205043524D4C4F476B +:1042E4000D0A000055534248532D3E454E41424C61 +:1042F40045203D20434F52450D0A00005553424886 +:10430400532D3E454E41424C45203D20434F52459E +:10431400202B205048590D0A0000000055534248F4 +:10432400532D3E454E41424C45203D204E6F6E6517 +:104334000D0A000073746F70205654494D20726545 +:1043440061636865640D0A0073746F702073616D36 +:0F435400706C696E670D0A00286E756C6C29001D +:1043640037579D5FB787935FB70600B02320075088 +:104374001386074085069387074894CF9306000465 +:1043840054C2B70600308506D4CF930700085CC238 +:104394009306600493070760D4C393064004D4C70C +:1043A40093070750B706D601D4D3232607562147CF +:1043B40098C305472388E186828083C7018751110A +:1043C40022C206C42A8491E3613FB747C02F1387F2 +:1043D400078023808780B7579D5F23AEE772054728 +:1043E40023A0E77423A40716B8CB37579D5F832710 +:1043F4008716F5DFA240124401453101828001474E +:10440400814718C15CC173700430B7C7995F03A7B3 +:10441400077A83A7477A18C15CC17360043082802D +:10442400511106C422C2856773B0077E3714C02FAA +:10443400832704E1DC43A183858B91CB3705C02F0F +:1044440005471305452CA38AE186EF001002832754 +:1044540004E1D8432183098B01C78546238AD18689 +:10446400D843418319CBD84383D68187418363766C +:10447400D700D8434183239BE1869843C14663F721 +:10448400E600B716C02F83A646E198C6D843C17686 +:104494009386F60F42074183D8C3D843758FD8C398 +:1044A400D843137707F013671700D8C3A240124408 +:1044B40031018280B71700F0985B1377F7EF98DB30 +:1044C400D85B1377F7EFD8DBB717C02F03A707E143 +:1044D4005C4393F707F093E737005CC3896773B0D5 +:1044E400077E7350017D73D0117D7350207DB71703 +:1044F400C02F83A747E19C477390377D73D0207DFD +:104504008280011126CA83D7218722CC06CE371494 +:10451400C02F99EF832744E11305F10061993EC24E +:104524002AC0F13D024592471041544190C3D4C37F +:10453400B737945F03A70760B717C02F9387C7E106 +:1045440098C33707945F83260752FD751385F50FCB +:10455400D4C303274752370300F47D1398C7371792 +:10456400965F130607401442130707489385F53FE7 +:104574008D8AD4C754428D8A94CB145FBD8AD4CB20 +:10458400545FBD8A94CF38433D8BD8CF3727965F8D +:10459400832607408D8A94D3832647408D8AD4D3BB +:1045A400032747493D8B98D73747965F83260740B3 +:1045B4008D8AD4D7832647408D8A94DB0327C74846 +:1045C4003D8BD8DB3737965F832607408D8A94DF8F +:1045D400832647408D8AD4DF0327074A3D8BB8C31F +:1045E4003757965F832607408D8AF4C38326474056 +:1045F4008D8AB4C703270749B756955F3D8BF8C723 +:1046040003A706407D8BB8CB03A74640B716C02F3F +:1046140083A686E10D8BF8CB3777955F0327074098 +:104624000D8BB8CF3787955F032707400D8BF8CFE5 +:1046340037D7965F03270740058BB8D303D7218765 +:104644001207BA96D843904798C2D8423D8A419BF4 +:10465400518FD8C290433D8B1206518FD8C2D04798 +:1046640098460D8A719B518F98C6904B4D9B0D8A2D +:104674000A06518F98C6D04B1377F7F03D8A12067D +:10468400518F98C6904F698F45753D8A2206518F88 +:1046940098C6D04F7D15698F3D8A3206518F98C6D2 +:1046A40090533705FDFF7D150D8A4206698F518FA2 +:1046B40098C6D0533705F4FF7D150D8A4A06698FD5 +:1046C400518F98C69057370510FF7D153D8A5206C5 +:1046D400698F518F98C6C857370600FD7D160D891E +:1046E4006205718F498F98C6885B337767000D899F +:1046F4006A05498F98C6C85B120711837205498FF2 +:1047040098C6885FD8460D89719B498FD8C6C85F03 +:104714004D9B0D890A05498FD8C6A8431377F7F036 +:104724003D891205498FD8C6E8431377F7CF0D8921 +:104734002205498FD8C6A8476D8F0D892A05498F50 +:10474400D8C6EC4775757D158D89B205698F4D8F77 +:10475400D8C6AC4B3745F8FF7D15FD89BA05698F7E +:104764004D8FD8C6EC4B3705E8FF7D158D89CE05F6 +:10477400698F4D8FD8C6AC4F370540FF7D158D89A5 +:10478400DA05698F4D8FD8C6EC4F718F71768D899C +:10479400E2054D8FD8C6BC5303D7E6001306F63D99 +:1047A400858B9607718FD98F2397F60083C741872E +:1047B400ADCB03D7218793074006631FF70083C758 +:1047C400518791C73705C02F1305852E7929B767FF +:1047D400085F054723A0E74003D721879307800C90 +:1047E400631FF70083C7518791C73705C02F13058F +:1047F4000530A529B767085F0D4723A0E74003D715 +:1048040021879307C012631EF70083C7518791C79E +:104814003705C02F130505328929B767085F23A020 +:10482400074083D72187032744E141768507C207E0 +:10483400C1832399F18683D621875C47F18FD58F75 +:104844005CC7F2406244D24405618280B717C02F2E +:1048540083A747E18146014794C3D8C3116713076F +:1048640007E898C7D847C176758FD8C703D781871B +:1048740042074183239BE18683D68187D847C206BA +:1048840042074183558FD8C7984B137707F098CBCD +:10489400984B1377F70F98CB23AA07008280B7179A +:1048A400C02F83A707E123A007008280511106C40B +:1048B40022C273D000BCC16773B0077E03D72187BF +:1048C40083D761876379F7002D39735000BCA24008 +:1048D40012443101828003C7118783C7518705CBF6 +:1048E40091C73705C02F130585334126B717C02F4D +:1048F40003A707E15C4393F707F093E747005CC322 +:10490400371700F03C4393F7F7EF3CC37DBF91C7E3 +:104914003705C02F1305C534892E7350007D73509D +:10492400107D7350207D8547A388F18679BF9D67EC +:10493400938707009183C207C1835111239CF18699 +:10494400B7077D5006C493871704F3A7077C7360E9 +:10495400043037C7995F8327877AB706004093E707 +:1049640017002324F77A8327077A0F00A00A8327E6 +:10497400477A0F00A00AF58FFDF773D010BC0537F6 +:10498400F135B71700F0B84313670710B8C3985B45 +:104994001367071098DBD85B13670710D8DB730025 +:1049A4005010F5BF511106C4593701000100010030 +:1049B400EDBF211122C806CA26C62AC0130400026C +:1049C4006354B002814711A0850702473E9703470D +:1049D40007007DFB63D2B7029D8D937726001304F5 +:1049E400000299C313040003058A814405E6937702 +:1049F400F40FAE843EC201A88145C5B712452EC44A +:104A0400FD14653AA245E34B90FEAE8463D30500E2 +:104A14008144858DA68739A02EC43EC2793A924737 +:104A2400A24585070247B3869740BA9603C5060098 +:104A340065F5AE841374F40F634C900063D30500E2 +:104A44008145D2404244B2443385F50061018280FD +:104A540022852EC23EC0953292458247FD14E9BF9D +:104A6400011122CC06CE26CAAE823284B6853A869D +:104A740001ED9307000328002314F1001D3FF240C9 +:104A84006244D244056182802A8301C82947639D18 +:104A9400E204635B05043303A040A3090100130788 +:104AA40031012545938767FCB37653026373D500C0 +:104AB400BE9693860603A30FD7FE9304F7FFB3565F +:104AC40053026375530209CC8DC59377260095C3B1 +:104AD4001305D00232C22EC0CD3082451246FD15D8 +:104AE4002685C13D229561BF014445BF2687368393 +:104AF40065BF9307D002A38FF4FE01449304E7FF3C +:104B0400C5B7211122C826C606CA2AC02E848144EC +:104B1400824783C7070099E7D24042442685B244BE +:104B24006101828013075002639AE7120247034629 +:104B340017007DD2930617006301F6129307D00283 +:104B440001476316F600824705479386270036C05F +:104B54009307000382461386160083C60600638506 +:104B6400F6048146A545A9438247024683C7070048 +:104B740093021600138607FD1375F60F63FAA50258 +:104B840013063007639BC70208409307440009E5F6 +:104B94003705C02F1305C5353EC23A86B685113D8B +:104BA4009247AA943E8425A81367270032C05DB7B4 +:104BB400B386760216C0B29645BF1306900663808C +:104BC400C7046362F60213063006638CC706130635 +:104BD4004006638DC70213068005638EC7048247AF +:104BE40085073EC035B713065007638AC70013060E +:104BF40080076385C7021306C006E392C7FE9302CB +:104C0400440016C293071006014639A093024400DB +:104C140016C2930710060546A94501A8930244004D +:104C240016C2930710060146C1450840153D92423D +:104C3400AA9416846DB79302440016C29307100415 +:104C4400DDB71040930744003EC22304C100A3040F +:104C540001003A86B685280099B736C08247850494 +:104C640003C50700EFF06FF59DBF1301C1FD06C634 +:104C74002EC832CA36CC3ACE3ED0737004300C08FB +:104C84002EC0413573600430B2401301410282806A +:104C940001A001A001A001A001A001A001A001A008 +:104CA40001A001A001A08280F40CC02F100EC02F1F +:104CB40000000000F40CC02F100EC02F03000000F1 +:104CC400000DC02F1C0EC02F00000000000DC02FCF +:104CD4001C0EC02F000000001C0EC02F1900000085 +:104CE400800EC02F030000008C0EC02F00000000B7 +:0C4CF400F80FC02FE00FC02F0010C02FE1 +:040000050E0E40009B +:00000001FF From 6bf1ea32dafee88562016fd25e20cad6ccb8ed35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Mon, 8 Sep 2025 16:20:52 +0200 Subject: [PATCH 09/10] use logger v1 from confluence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Łukasz Stępnicki --- lib/ppr_prl/ppr_prl.c | 52 +++--- scripts/west_commands/ppr_prl.py | 8 +- .../ppr_hex/pcrmlog_nvm_v1.hex | 161 ++++++++++++++++++ 3 files changed, 193 insertions(+), 28 deletions(-) create mode 100644 snippets/haltium_ppr_power_logger/ppr_hex/pcrmlog_nvm_v1.hex diff --git a/lib/ppr_prl/ppr_prl.c b/lib/ppr_prl/ppr_prl.c index 8143a95492ac..ae1658ee951a 100644 --- a/lib/ppr_prl/ppr_prl.c +++ b/lib/ppr_prl/ppr_prl.c @@ -4,44 +4,48 @@ #include #include - -#define PPR_LOAD_CONFIG_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908030UL) -#define PPR_START_SAMPLING_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908034UL) -#define STATE_PPR_PRL_READY 0x01 +#define PPR_LOAD_CONFIG_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908030UL) +#define PPR_START_SAMPLING_TASKS_TRIGGER *(volatile uint32_t *)(0x5F908034UL) +#define STATE_PPR_PRL_READY 0x01 typedef struct { - uint32_t vtim_cnttop; - uint8_t state; - uint8_t rfu; - uint16_t max_samples; + uint32_t vtim_cnttop; + uint8_t state; + uint8_t rfu; + uint16_t max_samples; } log_conf_t; /* log_conf inside the ppr ram, just writing straight to that */ -static log_conf_t *log_conf = (log_conf_t*)((uint32_t)(0x2fc007f8)); +static log_conf_t *log_conf = (log_conf_t *)((uint32_t)(0x2fc00ff8)); -void ppr_prl_configure(uint32_t max_samples, uint32_t vtim_cnttop) { - log_conf->vtim_cnttop = vtim_cnttop; - log_conf->max_samples = max_samples; - log_conf->rfu = 0; - sys_cache_data_flush_range(log_conf, sizeof(*log_conf)); +void ppr_prl_configure(uint32_t max_samples, uint32_t vtim_cnttop) +{ + log_conf->vtim_cnttop = vtim_cnttop; + log_conf->max_samples = max_samples; + log_conf->rfu = 0; + log_conf->state = 0; + sys_cache_data_flush_range(log_conf, sizeof(*log_conf)); - PPR_LOAD_CONFIG_TASKS_TRIGGER = 1ul; + PPR_LOAD_CONFIG_TASKS_TRIGGER = 1ul; - while (log_conf->state != STATE_PPR_PRL_READY) { - sys_cache_data_flush_and_invd_range(log_conf, sizeof(*log_conf)); - } + while (log_conf->state != STATE_PPR_PRL_READY) { + sys_cache_data_flush_and_invd_range(log_conf, sizeof(*log_conf)); + } } -void ppr_prl_start(void) { - PPR_START_SAMPLING_TASKS_TRIGGER = 1ul; +void ppr_prl_start(void) +{ + PPR_START_SAMPLING_TASKS_TRIGGER = 1ul; } #if CONFIG_PPR_PRL_AUTO_START -static int ppr_prl_auto_start(void) { - ppr_prl_configure(CONFIG_PPR_PRL_AUTO_START_CONFIG_MAX_SAMPLES, CONFIG_PPR_PRL_AUTO_START_CONFIG_VTIM_CNTTOP); - ppr_prl_start(); - return 0; +static int ppr_prl_auto_start(void) +{ + ppr_prl_configure(CONFIG_PPR_PRL_AUTO_START_CONFIG_MAX_SAMPLES, + CONFIG_PPR_PRL_AUTO_START_CONFIG_VTIM_CNTTOP); + ppr_prl_start(); + return 0; } SYS_INIT(ppr_prl_auto_start, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/scripts/west_commands/ppr_prl.py b/scripts/west_commands/ppr_prl.py index bf15eb1c8d50..19be561b336b 100644 --- a/scripts/west_commands/ppr_prl.py +++ b/scripts/west_commands/ppr_prl.py @@ -154,8 +154,8 @@ def do_add_parser(self, parser_adder): ) readout_parser.add_argument("-o", "--output", metavar="PATH", help="Path to the output file", required=True) readout_parser.add_argument("--dev-id", help="Device serial number") - readout_parser.add_argument("--address", help="Starting address of the log buffer to dump", default="0x2fc007e0") - readout_parser.add_argument("--entries-count", help="Number of log entries", type=int, default=1024) + readout_parser.add_argument("--address", help="Starting address of the log buffer to dump", default="0x2fc00fe0") + readout_parser.add_argument("--entries-count", help="Number of log entries", type=int, default=2048) return parser @@ -164,12 +164,12 @@ def do_run(self, args, unknown_args): self._flash(args) if args.command == "readout": self._readout(args) - + def _flash(self, args: argparse.Namespace) -> None: if not args.image: nrf_path = self.manifest.topdir + "/nrf" - image_path = "{}/snippets/haltium_ppr_power_logger/ppr_hex/firmware_nvm_v2.hex".format(nrf_path) + image_path = "{}/snippets/haltium_ppr_power_logger/ppr_hex/pcrmlog_nvm_v1.hex".format(nrf_path) else: image_path = args.image diff --git a/snippets/haltium_ppr_power_logger/ppr_hex/pcrmlog_nvm_v1.hex b/snippets/haltium_ppr_power_logger/ppr_hex/pcrmlog_nvm_v1.hex new file mode 100644 index 000000000000..845de8f4d909 --- /dev/null +++ b/snippets/haltium_ppr_power_logger/ppr_hex/pcrmlog_nvm_v1.hex @@ -0,0 +1,161 @@ +:020000040E0EDE +:104000009711000093810150138101A03304010036 +:10401000970200009382020F739072309712000093 +:10402000938262967390523073102034971200007E +:10403000938242CD171300001303C3CC97130000E3 +:104040009383C39A3D28971200009382A2CB1383D7 +:104050000181971300009383639925209382018146 +:104060001383018197130000938343991928938246 +:1040700001811383018197130000938323981120FA +:1040800021A8638A620003A5030023A0A200910275 +:104090009103E39A62FE82809382018113830181FE +:1040A0002128938201811383818139209382818128 +:1040B00013838181112009A86387620023A0020075 +:1040C0009102E39D62FE8280EF00500B0000000031 +:1040D00000000000000000000000000000000000E0 +:1040E00000000000000000000000000000000000D0 +:1040F00000000000000000000000000000000000C0 +:104100008A09C02F8C09C02F8E09C02F0000000023 +:104110009009C02F9209C02F000000009409C02F01 +:104120009609C02F9809C02F000000009A09C02FDF +:104130009C09C02F000000000000000000000000EB +:104140009E09C02F9E09C02F9E09C02F9E09C02F17 +:104150009E09C02F9E09C02F9E09C02F9E09C02F07 +:104160009E09C02F9E09C02F9E09C02F9E09C02FF7 +:104170000002C02F6006C02F9E09C02F9E09C02FCD +:104180009E09C02F00000000000000000000000099 +:10419000000000000000000000000000000000001F +:1041A000000000000000000000000000000000000F +:1041B00000000000000000000000000000000000FF +:0241C0000000FD +:0E41F00073002030130000006F00A078000064 +:10420000856773B0077EB716C02F83A706D0D84343 +:104210002183058B01CF05472389E180735000BCC2 +:104220009307F00F739017BC83A706D0D843218360 +:10423000098B01C78546A388D180D8432183118B80 +:1042400001C785462388D180D843418319C7D84305 +:1042500083D661814183636CD7023717C02F032750 +:1042600047D0944310476303D60014C7D843C176A0 +:104270009386F60F42074183D8C3D843758FD8C3BE +:10428000D843137707F013671700D8C38280D84349 +:104290004183239AE180D1B73111B717C02F83A78B +:1042A00047D026C67370043037C7995F0326077A54 +:1042B0008326477A7360043090C3D4C383D7418187 +:1042C0003717C02F832487D09207A6973EC263F684 +:1042D000F4188567938707F022C83EC43707945FB8 +:1042E00083270752C10423A8F4FE83274752373798 +:1042F000945F03270760BD8B1207D98F23AAF4FEB2 +:10430000B717965F03A4074083A3474083A2874B58 +:1043100003A3C74B03A5074CB727965F83A50740A8 +:1043200003A6474083A64749B747965F03A70740C0 +:1043300083A747400D888A033EC0B747965F83A78F +:10434000C74893F3C3009202F207C18F224493F24D +:10435000F20FB3E777003205220333738300B3E72C +:10436000570042054181B3E76700C98FC205370591 +:104370000300E98D4A0637050C00698ECD8FD18F79 +:104380000246B705F000D206ED8EB70200036207C1 +:1043900033775700B703000C6A06D58FD98F337770 +:1043A0007600D98F23ACF4FEB737965F03A407409D +:1043B00003A7474083A7074A3756965F83260640E0 +:1043C0000A070323464092078325064993F7F70F10 +:1043D0003756955F318B032506400D885D8FA20609 +:1043E000856703264640418F2A0337D4965FB2057E +:1043F00093F60630938707C0B377F300D98EC205D2 +:10440000032704403774955F03230440C1814205AC +:10441000DD8E3784955FB7071F00CD8EE98FB70516 +:104420006000032504405606D58F6D8EB7068000C8 +:104430005E07D18F758F620333735300D98F6A057E +:10444000B3E7670033757500C98F23AEF4FE73D0F0 +:10445000C07D9247E3E4F4E84244B717C02F03A7B6 +:1044600047D083D641815C474176F18FD58F5CC7B9 +:10447000B244510182803111B717C02F83A747D0B2 +:1044800026C67370043037C7995F0326077A8326E0 +:10449000477A7360043090C3D4C383D74181371700 +:1044A000C02F832487D09207A6973EC463FCF418DC +:1044B00022C89307F00F739007BCB706945F83A7D9 +:1044C00006520567130707F03AC29CC083A74652FD +:1044D000B736945F03A70660BD8BC1041207D98F5E +:1044E00023AAF4FEB717965F03A4074083A34740AF +:1044F00083A2874B03A3C74B03A5074CB727965F3F +:1045000083A5074003A6474083A64749B747965F60 +:1045100003A7074083A747400D888A033EC0B747DB +:10452000965F83A7C74893F3C3009202F207C18F37 +:10453000124493F2F20FB3E777003205220333738C +:104540008300B3E7570042054181B3E76700B70234 +:104550000300C205B3F55500C98F4A0637050C00A4 +:10456000698ECD8FD18F0246B705F000D206ED8E51 +:10457000B7020003620733775700B703000C6A06DF +:10458000D58FD98F33777600D98F23ACF4FEB73728 +:10459000965F03A4074003A7474083A7074A3756FF +:1045A000965F832606400A07032346409207832529 +:1045B000064993F7F70F3756955F318B0325064071 +:1045C0000D885D8FA206856703264640418F2A032A +:1045D00037D4965FB20593F60630938707C0B3775A +:1045E000F300D98EC205032704403774955F032377 +:1045F0000440C1814205DD8E3784955FB7071F00F7 +:10460000CD8EE98FB7056000032504405606D58F8F +:104610006D8EB70680005E07D18F758F620333738E +:104620005300D98F6A05B3E7670033757500C98FEA +:1046300023AEF4FE735000BC73D0C07DA247E3EA02 +:10464000F4E64244B717C02F03A747D083D6418171 +:104650005C474176F18FD58F5CC7B24451018280AF +:10466000611122C03714C02F032704D006C2B71629 +:1046700000F05C43096693F707F093E737005CC3EB +:104680009C5A93F7F7EF9CDADC5A93F7F7EFDCDAF2 +:104690005C4393F707F093E737005CC37330067E03 +:1046A0007350207D7350017D73D0117D3716C02F5C +:1046B000832746D09C477390377D73D0207D83C776 +:1046C0002181C9CF83C70181638D071483A6C1806F +:1046D00001473735945FF145930747198A07AA9731 +:1046E0009C430507910623AEF6FEE317B7FE83C78A +:1046F00011816386071A832746D07370043037C749 +:10470000995F0325077A8325477A7360043088C34D +:10471000CCC383D54181B717C02F83A787D08A0523 +:10472000BE9563F3B7021303F00F3735945F731030 +:1047300003BC03270560910723AEE7FE735000BC5E +:1047400073D0C07DE3E5B7FE032746D083D6418111 +:1047500041765C47F18FD58F5CC715A283C7018175 +:10476000B5CB83A6C18001473735945FF1459307E8 +:1047700047198A07AA979C430507910623AEF6FEC0 +:10478000E317B7FE83C71181638A070E832746D0DC +:104790007370043037C7995F0325077A8325477AFA +:1047A0007360043088C3CCC383D54181B717C02F51 +:1047B00083A787D08A05BE95E3F8B7F83735945FAD +:1047C00003270560910723AEE7FE73D0C07DE3E9C0 +:1047D000B7FE9DBF83C71181D5C3832746D07370B1 +:1047E000043037C7995F0325077A8325477A7360BA +:1047F000043088C3CCC383D54181B717C02F83A7AA +:1048000087D08A05BE95E3F1B7F43735945F032767 +:104810000560910723AEE7FE73D0C07DE3E9B7FEE4 +:1048200025B783C71181A5CF832746D07370043085 +:1048300037C7995F0325077A8325477A7360043069 +:1048400088C3CCC383D54181B717C02F83A787D036 +:104850008A05BE95E3FAB7EE1303F00F3735945F80 +:10486000731003BC03270560910723AEE7FE735066 +:1048700000BC73D0C07DE3E5B7FEF9B5313C7350A1 +:10488000007D7350107D032704D05C4393F707F03D +:1048900093E747005CC39240024421018280E13EDD +:1048A000F9BFBD67938707009183C207C1833707AC +:1048B0007D50239BF18093071704F3A7077C736057 +:1048C0000430B7C7995F03A7877A1367170023A43B +:1048D000E77A03A7077A0F00A00A03A7477A0F0019 +:1048E000A00A93161700E3C606FEB787935F4147F9 +:1048F000D8C3735000BC9307F00F739017BCB71761 +:10490000C02F03A707D0B717C02F83A747D02320F6 +:104910000700014588C381451167CCC3130707E829 +:1049200098C7D847C176758FD8C703D76181B716A6 +:1049300000F042074183239AE18003D66181D84782 +:10494000420642074183518FD8C7984B137707F02F +:104950001367170098CB984B1377F70F98CB23AAC0 +:1049600007009C5A93E707109CDADC5A93E707107C +:10497000DCDA7300501073005010E5BF711106C0EF +:104980000D37010001000100EDBF01A001A001A051 +:1049900001A001A001A001A001A001A001A001A00F +:1049A000E809C02F000DC02F00000000E809C02F4B +:1049B000000DC02F04000000F809C02F100DC02FFB +:1049C00000000000F809C02F100DC02F00000000EB +:1049D000100DC02F00000000100DC02F02000000BD +:1049E000180DC02F00000000F80FC02FE00FC02FDF +:0849F0000010C02F000FC02FC2 +:040000050E0E40009B +:00000001FF From 0788589ba4eb15c2a83a69ad57cbe2a86973be41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20St=C4=99pnicki?= Date: Mon, 6 Oct 2025 16:59:58 +0200 Subject: [PATCH 10/10] samples: nfc system_off added support for nrf54h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added support for nrf54h20dk. Unified reset reason include using nrfx. Signed-off-by: Łukasz Stępnicki --- samples/nfc/system_off/Kconfig.sysbuild | 11 ++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.conf | 9 +++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 15 +++++++++++ samples/nfc/system_off/remote/CMakeLists.txt | 12 +++++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.conf | 9 +++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 10 ++++++++ samples/nfc/system_off/remote/prj.conf | 8 ++++++ samples/nfc/system_off/remote/src/main.c | 23 +++++++++++++++++ samples/nfc/system_off/sample.yaml | 2 ++ samples/nfc/system_off/src/main.c | 20 +++++++++++---- samples/nfc/system_off/sysbuild.cmake | 25 +++++++++++++++++++ 11 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 samples/nfc/system_off/Kconfig.sysbuild create mode 100644 samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.conf create mode 100644 samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 samples/nfc/system_off/remote/CMakeLists.txt create mode 100644 samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.conf create mode 100644 samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay create mode 100644 samples/nfc/system_off/remote/prj.conf create mode 100644 samples/nfc/system_off/remote/src/main.c create mode 100644 samples/nfc/system_off/sysbuild.cmake diff --git a/samples/nfc/system_off/Kconfig.sysbuild b/samples/nfc/system_off/Kconfig.sysbuild new file mode 100644 index 000000000000..b38b757d407b --- /dev/null +++ b/samples/nfc/system_off/Kconfig.sysbuild @@ -0,0 +1,11 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +source "share/sysbuild/Kconfig" + +config REMOTE_CORE_BOARD +string + default "nrf54h20dk/nrf54h20/cpurad" if $(BOARD) = "nrf54h20dk" diff --git a/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 000000000000..eed83287e4db --- /dev/null +++ b/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_RUNTIME=y diff --git a/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 000000000000..0b91b7236bef --- /dev/null +++ b/samples/nfc/system_off/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&uart136 { + zephyr,pm-device-runtime-auto; + disable-rx; +}; + +&nfct { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; +}; diff --git a/samples/nfc/system_off/remote/CMakeLists.txt b/samples/nfc/system_off/remote/CMakeLists.txt new file mode 100644 index 000000000000..e0c68f5ff448 --- /dev/null +++ b/samples/nfc/system_off/remote/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(nrf_system_off_remote) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.conf b/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 000000000000..64d76c84480d --- /dev/null +++ b/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1,9 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_PM=y +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_RUNTIME=y diff --git a/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 000000000000..c8c8bed1b23d --- /dev/null +++ b/samples/nfc/system_off/remote/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + + &uart135 { + zephyr,pm-device-runtime-auto; + disable-rx; +}; diff --git a/samples/nfc/system_off/remote/prj.conf b/samples/nfc/system_off/remote/prj.conf new file mode 100644 index 000000000000..6893c82faa5b --- /dev/null +++ b/samples/nfc/system_off/remote/prj.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_UART_ASYNC_API=y +CONFIG_POWEROFF=y diff --git a/samples/nfc/system_off/remote/src/main.c b/samples/nfc/system_off/remote/src/main.c new file mode 100644 index 000000000000..197649af6cd0 --- /dev/null +++ b/samples/nfc/system_off/remote/src/main.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include +#include +#include +#include +#include +#include + +int main(void) +{ + if (IS_ENABLED(CONFIG_CONSOLE)) { + printf("%s system off demo. Ready for system off.\n", CONFIG_BOARD_TARGET); + } + + sys_poweroff(); + + return 0; +} diff --git a/samples/nfc/system_off/sample.yaml b/samples/nfc/system_off/sample.yaml index 9f21558877ac..d5cfde212a9a 100644 --- a/samples/nfc/system_off/sample.yaml +++ b/samples/nfc/system_off/sample.yaml @@ -14,6 +14,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp platform_allow: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 @@ -23,6 +24,7 @@ tests: - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp + - nrf54h20dk/nrf54h20/cpuapp tags: - ci_build - sysbuild diff --git a/samples/nfc/system_off/src/main.c b/samples/nfc/system_off/src/main.c index be3619c36900..995f468ffbbe 100644 --- a/samples/nfc/system_off/src/main.c +++ b/samples/nfc/system_off/src/main.c @@ -10,10 +10,7 @@ #include #include -#include -#if !NRF_POWER_HAS_RESETREAS -#include -#endif +#include #include #include @@ -175,6 +172,20 @@ static void print_reset_reason(void) printk("Power-on-reset\n"); } +#elif defined(NRF_RESETINFO) + reas = nrf_resetinfo_resetreas_global_get(NRF_RESETINFO); + if (reas & NRF_RESETINFO_RESETREAS_GLOBAL_NFC_MASK) { + printk("Wake up by NFC field detect\n"); + } else if (reas & NRF_RESETINFO_RESETREAS_GLOBAL_PIN_MASK) { + printk("Reset by pin-reset\n"); + } else if (reas & NRF_RESETINFO_RESETREAS_LOCAL_SREQ_MASK) { + printk("Reset by soft-reset\n"); + } else if (reas) { + printk("Reset by a different source (0x%08X)\n", reas); + } else { + printk("Power-on-reset\n"); + } + #else reas = nrf_reset_resetreas_get(NRF_RESET); @@ -194,7 +205,6 @@ static void print_reset_reason(void) #endif } - int main(void) { /* Configure LED-pins */ diff --git a/samples/nfc/system_off/sysbuild.cmake b/samples/nfc/system_off/sysbuild.cmake new file mode 100644 index 000000000000..b4b680cbf623 --- /dev/null +++ b/samples/nfc/system_off/sysbuild.cmake @@ -0,0 +1,25 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +if("${SB_CONFIG_REMOTE_CORE_BOARD}" STREQUAL "") + message(FATAL_ERROR + "Target ${BOARD} not supported for this sample. " + "There is no remote board selected in Kconfig.sysbuild") +endif() + +set(REMOTE_APP remote) + +ExternalZephyrProject_Add( + APPLICATION ${REMOTE_APP} + SOURCE_DIR ${APP_DIR}/${REMOTE_APP} + BOARD ${SB_CONFIG_REMOTE_CORE_BOARD} +) + +# Add dependencies so that the remote sample will be built first +# This is required because some primary cores need information from the +# remote core's build, such as the output image's LMA +add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP}) +sysbuild_add_dependencies(CONFIGURE ${DEFAULT_IMAGE} ${REMOTE_APP})