[SOLVED] RTC LSI Vbat – not possible

Timoteo
Thu Dec 13, 2018 9:50 pm
Hello all,
After a long time search in the forum it seems that the I can not use the RTC with the internal LS for time keeping?
Was this already fixed or is really a limitation of the controller?
Would like to implement the option of have a track of the time even when in sleep or power down mode.
The board(custom) I have the pin 1 is connected to a battery already.
Thanks in advance.
Tim

RogerClark
Thu Dec 13, 2018 10:58 pm
Which core are you using, what STM32 are you using.

ag123
Fri Dec 14, 2018 12:00 am
VBAT powers only LSE i.e. the 32k crystal, so you would need a 32k crystal no matter what
you could get cheap crystals on ebay, aliexpress, but get the better ones otherwise you may find your rtc drifting quite a bit.
and if i assume that you are using stm32f103 libmaple core the normal way is to power the VBAT on a coin cell
setup the RTC to run, set the time correctly
you could follow the examples in the library.
after that if you remove power (leaving VBAT connected) and when you power up the board again the time should be correct against a wall clock time

Timoteo
Fri Dec 14, 2018 5:30 pm
Hello,

Sorry for not clarify this I use the stm32f103CBT6 and the maple core toke from Roger git page.
The only problem now is that the board does not have space for upgrades and did not left the xtal pins longer for connections.
Internally is not possible at all?!
Thanks,
Tim


Timoteo
Tue Dec 18, 2018 9:14 am
Hello,

Have been reading the datasheet of the stm32f103 and it talks about an external high speed oscillator for RTC divided by 128.
Is this the 8MHz xtral used for clock the datasheet is refered?
Is it possible to use this crystal as the RTC clock instead of an 32,867KHz aplied to RTC pins?
Really need a solution for my problem that does not passes to build another pcb :)
Thanks.

All the best
Tim


ag123
Tue Dec 18, 2018 10:11 am
yup, you could use HSE for the RTC, but only LSE runs off VBAT and LSE runs on a 32k crystal, which means you’d need to keep the main VDD powered. LSI, HSE, HSI gets ‘switched off’ the moment you power off VDD, it didn’t matter even if you power VBAT

a ‘cheap’ solution, the $2 bluepill has an on board 32k crystal! you’d only need to power vbat :D
http://wiki.stm32duino.com/index.php?title=Blue_Pill
for my maple mini, i simply solder a cheap 32k crystal at PC14, PC15
http://wiki.stm32duino.com/index.php?title=Maple_Mini
i didn’t bother with caps and wrote some codes that adjust for drifts
viewtopic.php?f=18&t=4365


ag123
Tue Dec 18, 2018 10:50 am
another alternative, short of doing a new board is to explore low power
viewtopic.php?f=3&t=658
you could keep VDD powered for trickle currents, but low power is ‘tricky’

Timoteo
Tue Dec 18, 2018 1:14 pm
Hello ag123,

I decided to move to a new board as it is the only approach I can be confidence it will work.
Now, to keep the parts small and use the minimum board space as replace a 8MHz xtal with 2 xtals 1 of 8MHz and 1 of 32.768kHz the idea is to use a resonator of 8MHz and a normal crystal with 2 caps for the RTC.
Any advise on this subject is well come.

The low power is also a target to me but could not understand yet all the implementations in the post:
viewtopic.php?f=3&t=658

my design will use a reed switch to start the acquisition (gives power to the vdd).
Thanks for your inputs.

All the best,
Tim


ag123
Tue Dec 18, 2018 1:44 pm
low power mode switches the stm32 mcu into standby modes (effectively switched off)
but there are a lot of details to watch for, in terms of implementation it is only a few lines of code
the idea is to switch into standby mode and when it is woken up (say via a pin or via rtc) simply reboot/reset
that would look like the board is just powered up, details are discussed in that thread

i’d guess using a different board should resolve the problem, but do look out for the details e.g. like the 32k crystals etc
as i’ve not literally designed a board myself, i’d refrain from much comments about it


Timoteo
Tue Dec 18, 2018 5:13 pm
That thread is the way :)
When you say it is just some lines of code can you give an example?
Is it possible to wake up from an timer interrupt?
I would like my system works like:
turns on,
start acquire values and put then in a buffer, here I use interrupt to keep a fixed sample rate, already working.
transfer buffer to an external flash memory, already implemented.
when the memory is complete I send the device to sleep, here is also ok
but then every 10 seconds or so I would like to blink an led just to know it is complete and send to sleep again, could not perform this last step…
Any idea is more then welcome!
Tim

For the new board I used the stm32 appnote, it will work :)


ag123
Wed Dec 19, 2018 8:48 am
i posted some codes in the low power thread, not very well tested though
viewtopic.php?f=3&t=658&p=51756#p51756

Timoteo
Wed Dec 19, 2018 12:27 pm
Hello ag123,
Thanks for the reply will follow the low power thread…
This can be marked as resolved as it has not possible to use this function.
All the best,
Tim

Leave a Reply

Your email address will not be published. Required fields are marked *