Chibi System Time

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Rezy
Posts: 2
Joined: Wed Mar 04, 2015 10:59 am

Chibi System Time

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Chibi System Time

Post 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
Rezy
Posts: 2
Joined: Wed Mar 04, 2015 10:59 am

Re: Chibi System Time

Post 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
Post Reply