Page 1 of 1

Chibi System Time

Posted: Wed Mar 04, 2015 11:13 am
by Rezy
Hello,

I have a question concerning the system time. We have an internal frequency of 10000, which means, that every 0.1ms the system time will be increased. For uint32_t as systime_t this will overflow after around 4.9 days.
This will lead to problems in our project. Therefore I have the question if it is sufficient to change the define for the systime_t to uint64_t or do I have to change any others parts, too?
We are using an STM32F407. This question arises, because of the 64bit integer on an 32bit controller. Is the atomic access guaranteed or do we need to implement some logic for this problem?

Thanks in advance :)
Rezy

Re: Chibi System Time

Posted: Wed Mar 04, 2015 11:45 am
by Giovanni
Hi,

The system timer counter is designed to wrap to zero, this does not create any problem, it just means that you cannot have individual delays longer than 4.9 days.

The system is not going to enter an unstable state or anything.

64 bits counters have never been tested but there should be no need to do that.

Giovanni

Re: Chibi System Time

Posted: Wed Mar 04, 2015 6:28 pm
by Rezy
Hello,

thanks for your answer. In our project we've had some problems with overflows, but we've fixed it without changing the type of the variable.

Thanks anyway!

Rezy