Posted on May 17, 2011 at 12:30Yes I too think this is a problem. I changed it to keep reading until it gets two values the same which in 99.999% of cases will take just two reads. Code:u32 RTC_GetCounter(void) { u32 ticks, last_ticks = 0; for (;;...
Posted on May 17, 2011 at 12:28I want to ''copy'' the code on my STM32 using the ST flash loader as this seems like a good way of creating a bin file that contains both my bootloader and my application. This one bin file can then be used in producti...
Posted on May 17, 2011 at 12:28Hi bobz, I guess the other way it could be done is to keep reading 32 bit values until you get two consecutive values the same (usually 2 reads) but this isn't as elegant as your suggestion. Cheers Trevor
Posted on May 17, 2011 at 12:27Hi bobz, Many thanks for this. This looks like a good solution to me as the tick rate is usually quite slow (1 second). I agree that having to read 32 bit values in two goes is a pain. Maybe ST could implement your ato...
Posted on May 17, 2011 at 12:27The 32 bit RTC counter register value is read through two 16 bit registers - RTC_CNTH and RTC_CNTL. The ST FWLib does it like this:- Code:u32 RTC_GetCounter(void) { u16 tmp = 0; tmp = RTC->CNTL; return (((u32)RTC->C...