RTC on STM32F4-Discovery

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

Kirill
Posts: 4
Joined: Fri Oct 12, 2012 1:40 pm

RTC on STM32F4-Discovery

Postby Kirill » Mon Dec 24, 2012 5:43 pm

Hi,

ChibiOS 2.4.3 downloaded yesterday. Tried to enable RTC on STM32F4-Discovery demo (Keil).

HAL_USE_RTC is set TRUE. The rtc.x and rtc_lld.x files are added. I got a lot of such errors:

Code: Select all

..\..\..\os\hal\platforms\STM32\RTCv1\rtc_lld.c(113): error:  #136: struct "<unnamed>" has no field "CRL"
..\..\..\os\hal\platforms\STM32\RTCv1\rtc_lld.c(113): error:  #20: identifier "RTC_CRL_RSF" is undefined
..\..\..\os\hal\platforms\STM32\RTCv1\rtc_lld.c(116): error:  #136: struct "<unnamed>" has no field "CRH"


Also tried versions: 2.4.2 and 2.5.1. Only version 2.5.0 demo compiles successfully after enabling RTC.

Please help :)

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: RTC on STM32F4-Discovery

Postby Giovanni » Mon Dec 24, 2012 6:01 pm

Hi,

For some reason you are including the "RTCv1" RTC driver, the right one for the STM32F4xx is the RTCv2. It is strange because the standard makefiles include the right one. Verify your makefiles.

Giovanni

Kirill
Posts: 4
Joined: Fri Oct 12, 2012 1:40 pm

Re: RTC on STM32F4-Discovery

Postby Kirill » Mon Dec 24, 2012 6:23 pm

There is no RTCv2 folder in 2.4.3, just have checked (re-downloaded).

I found the difference in testhalls. STM32F1xx has RTC folder while STM32F4xx has not.

Please tell me what MCUs and dev boards are most used while developing ChibiOS? Maybe I just need some other platform for my hobby (at the very begging).

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: RTC on STM32F4-Discovery

Postby Giovanni » Mon Dec 24, 2012 7:09 pm

Hi,

The most recent ChibiOS/RT is 2.5.2unstable, I recommend using this one if you are not interested in the exception to the GPL license.

STM32F4xx is the best supported in this moment, I recommend the excellent Olimex STM32-E407 but also the cheap STM32F4-Discovery is very used with the bonus of the on-board debugger.

A comparison is here: http://www.chibios.org/dokuwiki/doku.ph ... ry_vs_e407

Giovanni

bezmic
Posts: 9
Joined: Fri Feb 28, 2014 9:07 pm

Re: RTC on STM32F4-Discovery

Postby bezmic » Sun May 04, 2014 1:36 pm

Hello.

On my board the RTC is 1-3% slow. How can i calibrate the RTC ? I can't find the CALP/CALM links on Chibios.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: RTC on STM32F4-Discovery

Postby Giovanni » Sun May 04, 2014 1:52 pm

Hi,

I think you have to operate on registers for this.

Giovanni

bezmic
Posts: 9
Joined: Fri Feb 28, 2014 9:07 pm

Re: RTC on STM32F4-Discovery

Postby bezmic » Sun May 04, 2014 8:22 pm

But in AN3371 wrote: The calibration settings can only be changed during initialization.
I must disable rtcInit() in ChibiOS's hal.c and declare proper init sequence?

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: RTC on STM32F4-Discovery

Postby Giovanni » Sun May 04, 2014 8:32 pm

You can enter the initialization mode even after the RTC initialization:

Code: Select all

/**
 * @brief   Beginning of configuration procedure.
 *
 * @notapi
 */
#define rtc_lld_enter_init() {                                              \
  RTCD1.id_rtc->ISR |= RTC_ISR_INIT;                                        \
  while ((RTCD1.id_rtc->ISR & RTC_ISR_INITF) == 0)                          \
    ;                                                                       \
}

/**
 * @brief   Finalizing of configuration procedure.
 *
 * @notapi
 */
#define rtc_lld_exit_init() {RTCD1.id_rtc->ISR &= ~RTC_ISR_INIT;}


Giovanni


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 10 guests