Rsl10 rtc & ble

Hi everyone

We are trying to get an RTC working on the ble_peripheral_server_bond example.
In the firmware reference, the following code lines are provided as examples:

Sys_RTC_Config(0, RTC_RESET | RTC_ALARM_1S |RTC_ENABLE |RTC_CLK_SRC_RC_OSC);
Sys_RTC_Start(RTC_ENABLE_BITBAND);

With the function Sys_RTC_Value() the current RTC value can be read.

If I do this, I always get back the value 0. I tried different start_values but didn’t succeed. Is there anything I missed?

The goal would be that we can build a freeRTOS application with BLE and other tasks which happen to need RTC timers.

Hi everyone

I would be very interested in an answer as well. We are facing a similar problem!

Thank you!

Regards

Sys_RTC_Config(0, RTC_RESET | RTC_ALARM_1S |RTC_ENABLE |RTC_CLK_SRC_RC_OSC);
Sys_RTC_Start(RTC_ENABLE_BITBAND);

You have requested the RTC to count repetively from 0 down to 0, so you can only read value 0.

Can you check with:

Sys_RTC_Config(0x7FFF, RTC_RESET | RTC_ALARM_1S |RTC_ENABLE |RTC_CLK_SRC_RC_OSC);
Sys_RTC_Start(RTC_ENABLE_BITBAND);

Then your Sys_RTC_Value() should return a value in the range [0…0x7FFF].

1 Like

Hi @rvs

Thank you for your response.
I tried your proposal and it does not work. Even with your proposal I get 0 as a return value.

My scenario:
I copy the BLE example project ble_peripheral_server_bond and use the lines:

Sys_RTC_Config(0x7FFF, RTC_RESET | RTC_ALARM_1S |RTC_ENABLE |RTC_CLK_SRC_RC_OSC);
Sys_RTC_Start(RTC_ENABLE_BITBAND);

to config the RTC and I use the function Sys_RTC_Value() to read the value periodically.
But I still get 0 back as a return value.

Do I need to set something else or activate the RTC somewhere else?

Did you start the 32KHz RC oscillator?

/* Start the RC oscillator */
Sys_Clocks_Osc32kHz(RC_OSC_ENABLE | RC_OSC_NOM);
1 Like

Thank you for the response.
It now works with the example code. But it still does not work with our code in the project. Unfortunately we can not identify the problem yet.
We will continue working on it and use this forum for any further questions.