Discussion:
[nuttx] RTC device driver for STM32 freescale
Alven Wu awu@cybertec.com.au [nuttx]
2018-02-16 07:01:11 UTC
Permalink
hi everyone

These days , I tried to make use of the RTC device in nuttx , but seems
failed even I configure the
RTC device carefully.

From the error info printed out , It seems the RTC device driver should be
initialized during the OS startup phase, and also from
arch/arm/src/common/up_initialize.c, seems the rtc_device initialization
has not been included. Even the function up_rtc_initialize under
arch/arm/src/stm32/stm32_rtcc.c has been designed.

So the question is that is the RTC device initialization supposed to be
called in up_initialize.c , then we can make use of the RTC device??

thanks.

Best Regards
Alven
Alan Carvalho de Assis acassis@gmail.com [nuttx]
2018-02-16 09:54:18 UTC
Permalink
Hi Alven,

Could you please explain it a little better?

What exactly are you trying to use?

I think you are trying to use the internal RTC of the STM32 right?

If so, what is the freescale (now NXP) relation with STMicro STM32?

BR,

Alan
Post by Alven Wu ***@cybertec.com.au [nuttx]
hi everyone
These days , I tried to make use of the RTC device in nuttx , but seems
failed even I configure the
RTC device carefully.
From the error info printed out , It seems the RTC device driver should be
initialized during the OS startup phase, and also from
arch/arm/src/common/up_initialize.c, seems the rtc_device initialization
has not been included. Even the function up_rtc_initialize under
arch/arm/src/stm32/stm32_rtcc.c has been designed.
So the question is that is the RTC device initialization supposed to be
called in up_initialize.c , then we can make use of the RTC device??
thanks.
Best Regards
Alven
spudarnia@yahoo.com [nuttx]
2018-02-16 14:27:20 UTC
Permalink
Perhaps this is referring to external NXP PCF85263?


https://www.nxp.com/products/analog/signal-chain/real-time-clocks/ic-real-time-clocks-rtc/tiny-real-time-clock-calendar-with-alarm-function-battery-switch-over-time-stamp-input-and-ic-bus:PCF85263A https://www.nxp.com/products/analog/signal-chain/real-time-clocks/ic-real-time-clocks-rtc/tiny-real-time-clock-calendar-with-alarm-function-battery-switch-over-time-stamp-input-and-ic-bus:PCF85263A



If that is the case, then you need to disable the STM32 RTC using CONFIG_RTC_EXTERNAL and you have to add board specific PCR85263 initialization logic.


You can see an example of this initialization logic in configs/samv71-xult/src/sam_bringup.c in the conditional logic based on HAVE_RTC_PCF85263.
Alven Wu awu@cybertec.com.au [nuttx]
2018-02-18 22:42:11 UTC
Permalink
Hi Alan

I am using the internal RTC of the STM32F072RB currently , and trying to
reuse the RTC device driver that has been implemented in STM32 f2, f3 ,
f4, f7 CPU and make some modifications to make it compatible for STM32F072..

and the question is that should we first initialize the RTC by the
up_rtc_initialize function under arch/arm/src/stm32/stm32_rtcc.c during the
OS startup phase?


thanks.

Best Regards
Alven
Post by Alan Carvalho de Assis ***@gmail.com [nuttx]
Hi Alven,
Could you please explain it a little better?
What exactly are you trying to use?
I think you are trying to use the internal RTC of the STM32 right?
If so, what is the freescale (now NXP) relation with STMicro STM32?
BR,
Alan
Post by Alven Wu ***@cybertec.com.au [nuttx]
hi everyone
These days , I tried to make use of the RTC device in nuttx , but seems
failed even I configure the
RTC device carefully.
From the error info printed out , It seems the RTC device driver should
be
Post by Alven Wu ***@cybertec.com.au [nuttx]
initialized during the OS startup phase, and also from
arch/arm/src/common/up_initialize.c, seems the rtc_device initialization
has not been included. Even the function up_rtc_initialize under
arch/arm/src/stm32/stm32_rtcc.c has been designed.
So the question is that is the RTC device initialization supposed to be
called in up_initialize.c , then we can make use of the RTC device??
thanks.
Best Regards
Alven
spudarnia@yahoo.com [nuttx]
2018-02-20 22:20:24 UTC
Permalink
That is done at line 249 of sched/clock/clock_initialize.c when the OS boots up:

242 void clock_initialize(void)
243 {
244 #if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL)
245 /* Initialize the internal RTC hardware. Initialization of external RTC
246 * must be deferred until the system has booted.
247 */
248
249 up_rtc_initialize();
250 #endif
251
252 /* Initialize the time value to match the RTC */
253
254 clock_inittime();
255 }

You should not have to do anything other than make certain that CONFIG_RTC is defined and CONFIG_RTC_EXTERNAL is not.
Alven Wu awu@cybertec.com.au [nuttx]
2018-02-22 07:57:26 UTC
Permalink
Hi

that's fantanstic.

thanks for your answer.

best regards
alven
Post by ***@yahoo.com [nuttx]
242 void clock_initialize(void)
243 {
244 #if defined(CONFIG_RTC) && !defined(CONFIG_RTC_EXTERNAL)
245 /* Initialize the internal RTC hardware. Initialization of external RTC
246 * must be deferred until the system has booted.
247 */
248
249 up_rtc_initialize();
250 #endif
251
252 /* Initialize the time value to match the RTC */
253
254 clock_inittime();
255 }
You should not have to do anything other than make certain that CONFIG_RTC
is defined and CONFIG_RTC_EXTERNAL is not.
Loading...