64bit system timer issues

Discussions and support about ChibiOS/RT, the free embedded RTOS.
DrTon
Posts: 6
Joined: Sat Oct 22, 2016 9:30 pm

64bit system timer issues

Postby DrTon » Fri Jan 29, 2021 11:01 pm

Hello!

On ChibiOS/RT 20.3 (https://github.com/ChibiOS/ChibiOS/tree/stable_20.3.x) I'm trying to switch system timer to 64 bit mode.
If system tick frequency is 10 000 everything works. But if I change it to 1000 000 (I need 1 microsecond time precision) or even 100 000, then everything goes wrong, e.g. chThdSleep() sleeps for incorrect time (and every time different).

In 32 bit mode everything works fine.
Didn't find any demos in 64 bit mode, is it fully supported?

```
CPU: STM32F765II

#define CH_CFG_ST_RESOLUTION 64
#define CH_CFG_ST_FREQUENCY 100000
#define CH_CFG_INTERVALS_SIZE 64
#define CH_CFG_TIME_TYPES_SIZE 32
#define CH_CFG_ST_TIMEDELTA 2

#define STM32_ST_USE_TIMER 5
```

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: 64bit system timer issues

Postby Giovanni » Sat Jan 30, 2021 7:27 am

Hi,

Try increasing the delta parameter, it is required when going to higher frequencies, you need to find the value experimentally because it depends also on the duration of your timer callbacks. Keep assertions enabled while doing this.

Giovanni

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: 64bit system timer issues

Postby steved » Sat Jan 30, 2021 10:25 am

If you don't need "global" 1us resolution, have a look at the last post here. It uses a separate counter to implement a high resolution virtual-timer style timer. Might need a little tweaking for your platform. I've also done something similar limited to the two or four comparators of a timer; limits the number of active timers, but less overhead.


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 7 guests