cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring time using an STM32F407VGT6

alex_samprasno1
Associate
Posted on March 20, 2015 at 22:03

Hello.

I'm using a custom board for charging and testing batteries. Its 'brain' is an STM32F407VGT6 microcontroller. I'm developing in Ubuntu (14.04.2 LTS), using ChibiStudio (ChibiOS/RT 3.0 development branch and Eclipse Kepler). While in charge mode, I need to see how much time has passed since I initially started charging the battery. I'm having trouble with writing the necessary steps required for the time measurement. The microcontroller has an internal real-time clock (RTC). It also has timers. And ChibiOS has a time measurement function. However, I went through the documentation, researched online, but I still cannot make it work. Any help or guidance would be appreciated. Thank you.

 Alex Dumitrescu

#stm32f407 #rtc #stm32f4-timer
2 REPLIES 2
Posted on March 21, 2015 at 01:23

Ok, what level of accuracy are you looking for?

If you can read the current time, you can presumably store a starting time, and then compare/difference that with the current time later on, right?

If you have a millisecond (1KHz) ticker, you can count off time with that.

What programming experience do you have?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
yuriy
Associate II
Posted on March 21, 2015 at 10:05

It seams for me that for battery charging ms accuracy

 will be enough. In this case you can use next ChibiOS functions http://chibios.sourceforge.net/docs3/rt/group__time.html. Pay attention that all functions usually use system ticks - not ms, so you need to ST2MS & MS2ST macros.

Accuracy of system time set by CH_CFG_ST_FREQUENCY define.