Change mqx ticks to 0.5 ms?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change mqx ticks to 0.5 ms?

1,165 Views
sivakumarananth
Contributor I

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?

0 Kudos
Reply
4 Replies

709 Views
RadekS
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

709 Views
sivakumarananth
Contributor I

Thanks a lot for your immediate reply.. I will try it over..

0 Kudos
Reply

709 Views
jamesmonczynski
Contributor II

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.

0 Kudos
Reply

709 Views
RadekS
NXP Employee
NXP Employee

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.

0 Kudos
Reply