Hi,
I am using ThreadX as the choice of RTOS and figured out by measuring that the system tick seems to run at a rate of 10ms.
e.g. calling the function qurt_thread_sleep(1); will result in a delay of 10ms, measured using a toggling GPIO pin.
I want to set system tick to 1ms. How can I do that? There is a section n DevCfg_master_fom_out_cdb.xml, but it seems not to have the desired effect.
<driver name="Timetick">
<props name="TIMER_FREQ" type="0x00000002">
<!-- Timer frequency = --> 32000
Any help appreaciated, thanks
Andreas
Our default qurt_thread_sleep(qurt_time_t duration) accept duration in ticks where 1 tick ~ 10 msec
However if you want to sleep for 1msec , kindly use as below:
qurt_thread_sleep(qurt_timer_convert_time_to_ticks(10, QURT_TIME_MSEC));
Hi Raja,
thanks for the reply but this does not work as described. If I use you code example to sleep for 1ms this results again in a 10ms sleep, which makes sense if you tick interval is 10ms.
How can I change the tick interval to 1 ms?
Regards
Andreas
Kindly try using qapi_Task_Delay ( uint32_t time_us ) which should help with your use case .
void qapi_Task_Delay ( uint32_t time_us )
Delays the current task by the time specified in microseconds.
Hi Raja,
I can confirm that using qapi_Task_Delay(1000); will delay the execution by 1ms now. Can you confirm that this really puts the RTOS thread to a sleep of 1ms and let other threads still run? To be sure that this function is not just a kind of loop that delays the execution of this thread and blocks others to run in the meantime.
Why is this function not part of the qurt API, which collects all OS related functions, if this is a task sleep?
Thanks, Andreas
void qapi_Task_Delay ( uint32_t time_us ) //Delays the current task by the time specified in microseconds.
Yes, this API puts the current task to a sleep of 1ms and let other threads still run.