How to translate the results of the measurement of time with the functions chTMStartMeasurementX and chTMStopMeasurementX to microseconds?
I use board STM32F4-DISCOVERY, if it is important, and the measurement results do not look like a millisecond, microsecond or system ticks.
Time measurement units
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Time measurement units
Giovanni wrote:Here: http://chibios.sourceforge.net/docs3/rt ... c4c6a70b35
Good. However, this function requires frequency value of the real time counter, but I do not know it. The Doxygen described function halGetCounterFrequency, which will let me know this value, but I use ChibiOS 3.0.0, which not contains function with this name (maybe it was renamed).
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Time measurement units
Hi,
The information is in the HAL, the RTOS knows nothing about CPU clock. Use STM32_SYSCLK.
Giovanni
The information is in the HAL, the RTOS knows nothing about CPU clock. Use STM32_SYSCLK.
Giovanni
Re: Time measurement units
Thank you. If I use RTC2US(STM32_SYSCLK, ...), it turns to normal (I tested the validity of measurements, measuring the duration chThdSleepMilliseconds(1)). However, so I lost a cross-platform (STM32_SYSCLK defined only for microcontrollers STM32). It's not so important now, but would like to learn for the future. Is there a cross-platform way to convert the measurement results to a microseconds?
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Time measurement units
No, the clock frequency is not available in a portable way at RT level.
You may abstract the information by defining your own macro.
Giovanni
You may abstract the information by defining your own macro.
Giovanni