Is there any calculation for MRT as counter for 1ms, 100ms, 1sec ?

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

Is there any calculation for MRT as counter for 1ms, 100ms, 1sec ?

1,423 Views
k_sunilgupta
Contributor II

Dear ALL,

I am doing register level programming using LPC54606J512BD100 with peripheral MRT which is working fine, But i want to generate counter delay for 1ms, 100ms, 1 sec. 

is there any calculation for this?

please tell me.

my core clock is 180 MHz.

@dalizhang @Sunil @xling @mgnxp 

0 Kudos
8 Replies

1,408 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The MRT module driving clock is from the AHB clock(Bus clock), for example, if the core clock of LPC54606J512BD100 is 180mhz, the AHB bus clock is also 180MHz, clock cycle time is 1/180MHz=5.55555nS

for 1mS delay, the required  counter value is 1mS/5.555555nS=180 000

for 100mS delay, the required counter value is 100ms/5.55555nS=18 000 000, the counter can not reach up to the value because of limited counter bits.

Because the counter is 24 bits, so that counter maximum value is 2**24=16 777 216, so the maximum delay time is 16 777 216/[(180*(10**6)]=93.206mS.

Hope it can help you

BR

XiangJun Rong

 

1,391 Views
k_sunilgupta
Contributor II

MRT 179999 FOR 2ms delay this the value please tell me is it right as per core clock 180 MHz.

because on CRO its showing 2ms delay.

just want to confirm is it right as per my value in MRT counter value.

0 Kudos

1,388 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The delay time is 179999*(1/180M)=1mS

Hope it can help you

BR

XiangJun Rong

0 Kudos

1,382 Views
k_sunilgupta
Contributor II

but on CRO its showing 2ms. with value of 179999

 

Is there issue in my core clock ?

0 Kudos

1,377 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

What is CRO?

I suppose you use the code like

void main()

{

.............

for(;;)

{

delay(179999); //implemented by MRT

toggle_LED();

}

You test the LED signal cycle time with oscilloscope, it is 2mS.

Pls note that the signal toggling twice to comprise a cycle, so the cycle is 2mS if MRT delay 1mS..

Pls check

BR

XiangJun Rong

0 Kudos

1,373 Views
k_sunilgupta
Contributor II

thankyou so much for the clearification.

0 Kudos

1,397 Views
k_sunilgupta
Contributor II

thanks for the help

0 Kudos

1,409 Views
frank_m
Senior Contributor III

> is there any calculation for this?

No.

This is a very bad idea for many reasons.

Use a timer. The best option is SystTick, which is portable amongst all Cortex M devices, and has an easy configuration interface. And there are already CMSIS functions to set it up.

0 Kudos