STM32F030 and RTC Topic is solved

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

Moderator: RoccoMarco

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 »

It should just operate without periodic wakeups.

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 »

Actually, since I have downloaded them, I have updated STM32F0xx CMSIS files on trunk today.

If hardware doesn't support periodic wakeup you are not able to use these two APIs:

Code: Select all

  
void rtcSTM32SetPeriodicWakeup(RTCDriver *rtcp, const RTCWakeup *wakeupspec);
void rtcSTM32GetPeriodicWakeup(RTCDriver *rtcp, RTCWakeup *wakeupspec);


I am marking this topic as solved promising to keep an eye on future events.
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 for all of this! So I guess before we walk away, did you manage to get a RTC demo ported to the F030 (even without the periodic wakeups)? What changes are necessary?
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 »

My suggestion is to take inspiration from the STM32F4xx/RTC demo (since it use RTCv2 as well), anyway you cannot use anabios() or you will not be able to wakeup MCU through the RTC.

If you are planning to use shell you could not be able to include testsuite (depending on youe MCU's flash size). If you are working on trunk note that there is a switch you can disable to exclude test command from shell. It should be something like SHELL_USE_TEST_CMD.
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 »

OK I will try that next week, however I would be most interested in using this as a wakeup source from Stop/Suspend modes, so if that isn't possible I'll either interface an external RTC or use a different chip I guess.

If I understand correctly, we need periodic wakeups for returning from Stop/Suspend? The nomenclature is a bit odd to me.
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 »

If you enter in sleep mode by a WFI instruction, like in the case of anabios() from RTC demo, it is required an Interrupt from NVIC to wake up the device: period wakeup is actually an interrupt.

Using WFE instruction it is required an event to wake up the device (as example configuring EXTI in event mode).
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 »

Hi Marco, haha sorry I didn't explain myself very clearly. I understand you need an interrupt/event to wake the device up, but my comment regarding the nomenclature was that it needed to be a "periodic" wakeup. I really only need a single shot alarm, not a periodic source. That is what I mean by the nomenclature is odd :)

This being said, I found this thread over at ST that seems to indicate wakeup from STOP mode is possible.

PS could you please post a link to your question on the ST forums regarding the stm32f030x6.h header to keep this thread complete?
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 suppose that periodic means you can set a timeout and issue a wakeup periodically.

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 »

Hi Rocco,

First I apologize for calling you by your surname in my last post, I broke my rule of not posting on the internet before coffee :)

I note that in the STM32/LLD/RTCv2/rtc.c in rtc_lld_set_alarm, it seems to set up the interrupt bit ARLAIE when setting an alarm. Do you think this means that I can use the (non-periodic) RTC alarm interrupt as a way to wake up the uC? I tried to test it by setting a callback function, but rtccb_t doesn't seem to be defined for RTCv2, even if I hack the RTC_HAS_INTERRUPTS to be true in stm32_registry.h.

I then tried setting an alarm, and going to sleep, but it doesn't seem to ever wake up.
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 »

Hey,
I have received an answer from ST. They said "only STM32F030xC supports periodic wakeup". I will check if periodic wakeup is enabled for this MCU in the next days.

First I apologize for calling you by your surname in my last post

Actually my surname is Gugliemi, Rocco is my first name and Marco my second name. Yes I know it is very unusual. :mrgreen:
Ciao,
RM

unnamed.png
Post Reply