Using RTC0 with nrf9151 custom board

Hi all,

I'm trying to use rtc0 with my custom board build with an nrf9151, but I got a secure fault. I've activated rtc in an overlay file

&rtc0 {
    status = "okay";
};

In my prj.conf

CONFIG_COUNTER=y
CONFIG_RTC=y
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y

But when I'm trying to init rtc with the following code, 

#define RTC_NODE DT_NODELABEL(rtc0)  

const struct device *rtc_dev;
static uint32_t unix_timestamp_base = 0;

atomic_t rtc_synchro = ATOMIC_INIT(0); 

int init_rtc(const uint32_t timestamp_start)
{
	if (!device_is_ready(rtc_dev)) {
        printk("RTC device not ready\n");
        return -1;
    }

	unix_timestamp_base = timestamp_start;
	counter_start(rtc_dev);
	atomic_set(&rtc_synchro, 1);

	return 0;
}

I got the following error:

RTC device not ready
[00:00:02.957,824] <err> os: ***** SECURE FAULT *****
[00:00:02.957,824] <err> os:   Address: 0x8
[00:00:02.957,855] <err> os:   Attribution unit violation
[00:00:02.957,855] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000005  r2/a3:  0x00000004
[00:00:02.957,885] <err> os: r3/a4:  0x2001c94c r12/ip:  0x00000004 r14/lr:  0x000537cb
[00:00:02.957,916] <err> os:  xpsr:  0x01000000
[00:00:02.957,946] <err> os: Faulting instruction address (r15/pc): 0x00053730
[00:00:02.957,977] <err> os: >>> ZEPHYR FATAL ERROR 41: Unknown error on CPU 0
[00:00:02.958,007] <err> os: Current thread: 0x2001c648 (unknown)
[00:00:03.052,246] <err> os: Halting system

I've check my dts file after build the app and rtc0 is activated

....
rtc0: rtc@14000 {
	compatible = "nordic,nrf-rtc";
	reg = < 0x14000 0x1000 >;
	cc-num = < 0x4 >;
	interrupts = < 0x14 0x1 >;
	status = "okay";
	clock-frequency = < 0x8000 >;
	prescaler = < 0x1 >;
};
....

Ps: I build my app with non secure for my custom board

Related