Page 1 of 1
real time clock
Posted: Mon Dec 23, 2013 4:03 pm
by AndreyB
We need a real time clock module. The module should be cheap

But it should also survive short-term power disconnects.
We will probably start by one of the existing modules, but eventually we would need our KiCad files

Re: real time clock
Posted: Mon Dec 23, 2013 6:02 pm
by acab
You sure that RTC not build in STM32F407? You need it for logging to SDCard?
Or you need it with external power source? On
sparkfun.com you can buy RTC module with DS1307 chip.
Schematic
Eagle Files
GIT
Re: real time clock
Posted: Mon Dec 23, 2013 6:23 pm
by AndreyB
STM32F407 (the chip) does not have build-in RTC - it requires external oscillator. STM32F4discovery does not have the RTC oscillator soldered on it, there is a manual how to add it - but the other problem is
power consumption, and that's too much programming for my small brain.
I like everything about this
BOB-00099 but I do not like the price, why is it so damn expensive? I will order one of the DS1307 modules from eBay. Does anyone know why it looks like two chips on these DS1307 eBay modules?
Anyway I think we will still need KiCad files so that we can put all this on our own module?
I guess just soldering these module to our board is also an option, but there is the risk that they will stop making them. Maybe we need to draw a KiCad schematics of a HOLE in our PCB to which we will solder one of these Chinese modules?
Re: real time clock
Posted: Mon Dec 23, 2013 6:26 pm
by AndreyB
I have ordered two of the eBay modules.
Artem, is there any chance you can order the same DS1307 module from China and write all the needed code?
Re: real time clock
Posted: Mon Dec 23, 2013 6:33 pm
by acab
russian wrote:I have ordered two of the eBay modules.
Artem, is there any chance you can order the same DS1307 module from China and write all the needed code?
I havent money yet ;(
And i say about problem of payment from Belarus via Visa\PayPal. Our cards didnt trusted ;(
I can try make code for that. I think its not hard...
UPDATE: you sure that your board didnt have oscillator for RTC? My board have it...
Re: real time clock
Posted: Mon Dec 23, 2013 7:20 pm
by rus084
why RTC can't have in programm of stm32f4?
quartz oscillator in microcontroller have little error in frenqarity . else how profit from RTOS?
Re: real time clock
Posted: Mon Dec 23, 2013 7:24 pm
by AndreyB
rus084 wrote:why RTC can't have in programm of stm32f4?
quartz oscillator in microcontroller have little error in frenqarity . else how profit from RTOS?
First of all,
there is no oscillator inside the chip itself. Secondly, I have no idea why - but for RTC you need a separate oscillator. Also you are forgetting ABOUT POWER CONSUMPTION.
Re: real time clock
Posted: Tue Dec 24, 2013 4:56 am
by acab
How to add RTC support for Discovery:
Without parts at X3, C16, C27, and removing SB15 and SB16, the LSE is not going to tick or come ready
Better idea to use integrated RTC in STM32F4, becouse there are complete librarys and all stuff for work with RTC.
About consumption, read please datasheet paragraf
2.2.20 VBAT operation.
Re: real time clock
Posted: Tue Dec 24, 2013 5:03 am
by AndreyB
Code: Select all
2.2.20 VBAT operation
The VBAT pin allows to power the device VBAT domain from an external battery, an external
supercapacitor, or from VDD when no external battery and an external supercapacitor are
present.
VBAT operation is activated when VDD is not present.
The VBAT pin supplies the RTC, the backup registers and the backup SRAM.
Note: When the microcontroller is supplied from VBAT, external interrupts and RTC alarm/events
do not exit it from VBAT operation.
When PDR_ON pin is not connected to VDD (internal reset OFF), the VBAT functionality is no
more available and VBAT pin should be connected to VDD.
It looks like we do not need external RTC chip. What we need would be to 'upgrade' discovery to RTC configuration and figure out power supply. So, we still need a KiCad module for with proper battery or battery housing, but things are look up

Thank you Artem! Why did not you explain this before I have wasted $4 on these RTC modules?

Re: real time clock
Posted: Tue Dec 24, 2013 12:08 pm
by acab
russian wrote:Code: Select all
2.2.20 VBAT operation
The VBAT pin allows to power the device VBAT domain from an external battery, an external
supercapacitor, or from VDD when no external battery and an external supercapacitor are
present.
VBAT operation is activated when VDD is not present.
The VBAT pin supplies the RTC, the backup registers and the backup SRAM.
Note: When the microcontroller is supplied from VBAT, external interrupts and RTC alarm/events
do not exit it from VBAT operation.
When PDR_ON pin is not connected to VDD (internal reset OFF), the VBAT functionality is no
more available and VBAT pin should be connected to VDD.
It looks like we do not need external RTC chip. What we need would be to 'upgrade' discovery to RTC configuration and figure out power supply. So, we still need a KiCad module for with proper battery or battery housing, but things are look up

Thank you Artem! Why did not you explain this before I have wasted $4 on these RTC modules?

You wasted 4$ becouse you hate me)))
Its revenge)!
Re: real time clock
Posted: Tue Dec 24, 2013 6:38 pm
by jedediah_frey
russian wrote: I have no idea why - but for RTC you need a separate oscillator. Also you are forgetting ABOUT POWER CONSUMPTION.
I did the math on power consumption here:
http://rusefi.com/forum/viewtopic.php?f=4&t=236&hilit=+RTC A C2032 battery should power the RTC for 12 years a 60 AH car battery for 3422 years.
While it may not work on the STM32F4 Discovery board when you get your own board designed the ideal solution is to use the RTC on the 407VG. (And f or your own board I think you may as well look at th 427/437 since it has double the flash. and it's the latest and fastest. (Another 12 MHz over the 407).
Re: real time clock
Posted: Tue Dec 24, 2013 6:42 pm
by AndreyB
Until yesterday I did not realize that stm32 has the VBAT pin with a special RTC mode. I was wrongly assuming that the whole unit would need to stay up.
180MHz is a different story altogether

We will do this eventually but right now it's not worth the time to figure our the differences.
So, we are going with the 407 rtc. We now need a KiCad module for the battery as an add-on to the stm32f4discovery and we need someone with the hardware to implement the needed code.
Re: real time clock
Posted: Tue Feb 21, 2017 2:31 am
by AndreyB