2013-11-25 01:38 PM
Hello I am a rookie C programmer who has a problem with a STM32F2 microcontroller I have configured the RTC API according to STM, but when 24 hours is exceeded the date does not update, it only updates when you do a power cycle
can anyone help #c #rtc2013-11-26 07:55 AM
I am a rookie C programmer
Embedded is NOT a good place to learn C, get reasonably fluent on the PC, THEN tackle embeddedcan anyone help
not unless you show your code Erik
2013-11-27 06:58 AM
When you access the RTC registers you are reading from shadow copies. To guard against simultaneous updates (i.e. time rolls over to new day while reading the date register first) the two shadow registers are locked against updates. Make sure you read both registers, not just RTC_TR, to free the update lock. From the 'F2 manual:
To ensure consistency between the 2 values, reading RTC_TR locks the values in the higher-order calendar shadow registers until RTC_DR is read.
As for being new to C, well, everyone has to start somewhere. In the bad old days when big iron dinosaurs roamed the Earth (who remembers Univac or XDS now?) embedded programmers did not have the luxury of starting with C, or even assembly language. The only tool was the front panel deposit switch on that old DG Nova or PDP-8 and a piece of paper to write down the binary. So ignore the slanted remarks from the Peanut Gallery (and only those who remember big iron machines know what the Peanut Gallery was) and forge ahead with your embedded project. But don't entirely ignore Erik's advice, he also has more than a few years experience to draw on.