for creating a real time system i need to have system time which has microsecond precision.
i used halGetCounterValue() and halGetCounterFrequency(). but it will reset every 25 second.
my code is lke this :
Code: Select all
uint32_t tnow = getSystemTimeInMicroSecond();
while(true)
{
if(getSystemTimeInMicroSecond() - tnow => 13333)
{ tnow = getSystemTimeInMicroSecond();
dojobOne();
}
if(getSystemTimeInMicroSecond() - tnow >= 25555)
{ tnow = getSystemTimeInMicroSecond();
dojobTwo();
}
}so i cannot use chThdSleepMicrosecond().
chTimeNow() gives me a 1 millisecond precision.if i had a counter which counts every 168 ticks of micro (stm32f4-168mhz) i will have a system time in micro second.
is it possible to implement this ?? if yes how ??