How to set periodic timer with period to 0.5 ms? how to change and what value to bsp_alarm_frequency to fix 0.5ms?
Please edit your user_config.h file at:
c:\Freescale\Freescale_MQX_4_1\config\frdmk64f\user_config.h
and add there definition of your value:
#define BSP_ALARM_FREQUENCY (2000)
After that, please rebuild your BSP library.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks a lot for your immediate reply.. I will try it over..
I don't think that will work. From my custom K70 bsp include file:
/*
** The clock tick rate in milliseconds - be cautious to keep this value such
** that it divides 1000 well
**
** MGCT: <option type="number" min="1" max="1000"/>
*/
#ifndef BSP_ALARM_FREQUENCY
#define BSP_ALARM_FREQUENCY (1000)
#endif
I run at 1 ms tick, but i do not think you can go faster.
In fact, you can set BSP_ALARM_FREQUENCY to 2000 and it will work.
It is not right solution, however it is possible.
However there is at least one pottential issue:
Macro BSP_ALARM_RESOLUTION is defined as (1000 / BSP_ALARM_FREQUENCY).
When we divide 1000 by 2000, we will get 0.5 and after retype to integger it is 0.
Some of drivers (ESDHC, Ethernet PHY drivers) use commands _time_delay(BSP_ALARM_RESOLUTION);. In that case we could get unexpected behaviour of these drivers.
Why it is not right solution: Scheduling, task context switching, interrupt handling,... will be serviced too often. So, you will get too big system overhead.
If you want some precise time interrupt, you should use for example hwtimer module/driver.