nrf52840 RCT2 configuration and usage

Hello,

I'm trying to enable RTC2 for nrf52840 DK to use as a date time clock and set/get over SMP protocol. RTC0 is used for MPSL, RTC1 is used by the system.

I configured MCU MGR option:

CONFIG_MCUMGR_GRP_OS_DATETIME=y

I configured RTC:

CONFIG_COUNTER=y
CONFIG_NRFX_RTC2=y
CONFIG_RTC=y

DTS for RTC2:

aliases {
		rtc = &rtc2;
	};
	
&rtc2 {
    status = "okay";
};

The command to set date-time works and return empty result. But when try to get date-time I see strange result. For instance:

{
  "datetime": "39997-165-36T05:168:00"
}

And now matter how many times I get it I see the same.

For me it looks like the RTC2 is not initialized. But i check it readiness in main:

if (!device_is_ready(rtc)) {
		printk("Device RTC is not ready\n");
		return 0;
	}
 

Anything I forget to do to use RTC2 as a date-time source?

Parents
  • Hi

    Just to check, are you using the os_mgmt_datetime sample in <ncs version>\zephyr\tests\subsys\mgmt\mcumgr\os_mgmt_datetime for this? Where does this strange output print from exactly? Are you sure you have set the date time as reference somewhere in your project so the RTC has a reference point? 

    Can you show me the full log of your application running so we can get a better understanding of what exactly is returning this value?

    Best regards,

    Simon

Reply
  • Hi

    Just to check, are you using the os_mgmt_datetime sample in <ncs version>\zephyr\tests\subsys\mgmt\mcumgr\os_mgmt_datetime for this? Where does this strange output print from exactly? Are you sure you have set the date time as reference somewhere in your project so the RTC has a reference point? 

    Can you show me the full log of your application running so we can get a better understanding of what exactly is returning this value?

    Best regards,

    Simon

Children
No Data
Related