Skip to content

Commit 9710cb1

Browse files
maje-embcarlescufi
authored andcommitted
samples: esb: Prevent UART PM suspend/resume in interrupt context
Use pm_device_runtime_get() to keep the UART powered on the nRF54H20. Ref: NCSDK-35622 Signed-off-by: Marcin Jelinski <[email protected]>
1 parent 843ca70 commit 9710cb1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

samples/esb/esb_prx/src/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <esb.h>
1515
#include <zephyr/kernel.h>
1616
#include <zephyr/types.h>
17+
#include <zephyr/pm/device_runtime.h>
1718
#include <dk_buttons_and_leds.h>
1819
#if defined(CONFIG_CLOCK_CONTROL_NRF2)
1920
#include <hal/nrf_lrcconf.h>
@@ -203,6 +204,18 @@ int main(void)
203204

204205
LOG_INF("Enhanced ShockBurst prx sample");
205206

207+
#if defined(CONFIG_SOC_SERIES_NRF54HX)
208+
const struct device *dtm_uart = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_console));
209+
210+
if (dtm_uart != NULL) {
211+
int ret = pm_device_runtime_get(dtm_uart);
212+
213+
if (ret < 0) {
214+
printk("Failed to get DTM UART runtime PM: %d\n", ret);
215+
}
216+
}
217+
#endif /* defined(CONFIG_SOC_SERIES_NRF54HX) */
218+
206219
err = clocks_start();
207220
if (err) {
208221
return 0;

samples/esb/esb_ptx/src/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <zephyr/devicetree.h>
1515
#include <zephyr/kernel.h>
1616
#include <zephyr/types.h>
17+
#include <zephyr/pm/device_runtime.h>
1718
#include <dk_buttons_and_leds.h>
1819
#if defined(CONFIG_CLOCK_CONTROL_NRF2)
1920
#include <hal/nrf_lrcconf.h>
@@ -208,6 +209,18 @@ int main(void)
208209

209210
LOG_INF("Enhanced ShockBurst ptx sample");
210211

212+
#if defined(CONFIG_SOC_SERIES_NRF54HX)
213+
const struct device *dtm_uart = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_console));
214+
215+
if (dtm_uart != NULL) {
216+
int ret = pm_device_runtime_get(dtm_uart);
217+
218+
if (ret < 0) {
219+
printk("Failed to get DTM UART runtime PM: %d\n", ret);
220+
}
221+
}
222+
#endif /* defined(CONFIG_SOC_SERIES_NRF54HX) */
223+
211224
err = clocks_start();
212225
if (err) {
213226
return 0;

0 commit comments

Comments
 (0)