STM32F030 and RTC Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

STM32F030 and RTC

Post by dflogeras »

Hi,

GCC-4.9.3, newlib-2.2.0, binutils-2.25, ChibiOS-3.0.5

I'm playing with a new chip, namely STM32F030. I'm interested in using its RTC to set an alarm and wake the device up after a snooze. I used the testhal/STM32F1xx/RTC program as a starting point and enabled the HAL_USE_RTC. When I try to compile, I get

Code: Select all

main.c:133:3: warning: implicit declaration of function ‘rtcSTM32GetSecMsec’ [-Wimplicit-function-declaration]
   rtcSTM32GetSecMsec(&RTCD1, &tv_sec, NULL);
   ^
main.c:133:31: error: ‘tv_sec’ undeclared (first use in this function)
   rtcSTM32GetSecMsec(&RTCD1, &tv_sec, NULL);
                               ^
main.c:133:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:134:12: error: ‘RTCAlarm’ has no member named ‘tv_sec’
   alarmspec.tv_sec = tv_sec + 20;


After looking in the specific rtc_lld.h, I see it is because STM32_HAS_PERIODIC_WAKEUPS is not defined in stm32_registry.h for this device. According to this the device's RTC does have periodic wakeup. I'm not sure how to fix this, help/advice is appreciated!
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F030 and RTC

Post by RoccoMarco »

I will take a look. It could be a bug.
Thanks. Ciao,
RM
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: STM32F030 and RTC

Post by dflogeras »

Thanks Rocco! I'm happy to test patches if you do not have access to hardware.

Dave
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F030 and RTC

Post by RoccoMarco »

Thanks a lot... In this case I have a STM32 Nucleo64-F030R8. I am porting the RTC demo to test the HAL.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F030 and RTC

Post by RoccoMarco »

So I am editing the DEMO. The biggest problems appears to be the missing of all the bit mask and structure related to Periodic Wakeup.
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: STM32F030 and RTC

Post by dflogeras »

I notice that in os/ext/CMSIS/ST/stm32f030x8.h there are a couple fields missing from the RTC_* related registers. For instance RTC_CR does not include RTC_CR_WUTE and RTC_CR_WUTIE, but the data sheet indicates these fields are present in the f030x6/8/C devices as well as the f070x6/B devices.

I assume that these headers come directly from ST/ARM and not ChibiOS, is there a newer CMSIS available that includes these? I'm not sure where they come from, I have an ARM CMSIS package downloaded to get the DSP libraries but it does not include these files.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F030 and RTC

Post by RoccoMarco »

I assume that these headers come directly from ST/ARM and not ChibiOS, is there a newer CMSIS available that includes these? I'm not sure where they come from, I have an ARM CMSIS package downloaded to get the DSP libraries but it does not include these files.


Indeed these headers comes directly from ST. Even more the RTC struct misses RTC_WUTR! It is very strange. I have checked documentation more than once looking for a note saying that wakeup is not available on STM32F030xx (without success).
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F030 and RTC

Post by Giovanni »

Header files are those released by ST in Cube MX, our policy is to not modify them.

I suggest to post about this in the ST forums and ask if it is an header error or if the feature is really missing in the device.

Giovanni
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F030 and RTC

Post by RoccoMarco »

Giovanni wrote:Header files are those released by ST in Cube MX, our policy is to not modify them.
I suggest to post about this in the ST forums and ask if it is an header error or if the feature is really missing in the device.


I can confirm. Indeed, We can not know whether the error is in the CMSIS header or documentation. I will ask on the STM32 forum. Until that moment we will assume that RTC doen't have periodic wakeup.
Ciao,
RM
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: STM32F030 and RTC

Post by dflogeras »

Thanks Rocco,

In the meantime I downloaded the latest headers from ST, and while there are numerous changes from the one included with ChibiOS-3.0.5 (ST ver 2.0.1, versue 2.2.3) they didn't add the registers/bitmaps in question.

Out of curiousity, if the HW itself doesn't support the periodic wakeups, does the current RTC driver implementations operate in a diminished mode, or not at all?
Post Reply