Priorities of the channels of the LPC82x MRT timer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Priorities of the channels of the LPC82x MRT timer

ソリューションへジャンプ
762件の閲覧回数
topspin
Contributor II

Hi all,

I am using two channels of the MRT timer with the "Repeat interrupt mode" to run two different part of my code at different rates. My question is: how is the priority handled between two channels of the MRT timer? for instance I have MRTch1 running at 1kHz (with 2us of execution time) and MRTch2 running at 10kHz (with 40us of execution time), how can I make MRTch1 at higher priority than MRTch2?

 

 

0 件の賞賛
返信
1 解決策
750件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the all MRT channels share the same interrupt vector for LPC82x, in other words, all MRT channels enter the same ISR, there is not priority concept for different MRT channels.

In the ISR, you have to check the MRT->IRQ_FLAG register to know the interrupt source and take action for different flag.

Assume two interrupt events of MRT module happen, the LPC82x will enter ISR, both flags in the MRT->IRQ_FLAG will be set, you can take action in the ISR for the two interrupt events

Hope it can help you

BR

XiangJun Rong

 

元の投稿で解決策を見る

0 件の賞賛
返信
7 返答(返信)
751件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the all MRT channels share the same interrupt vector for LPC82x, in other words, all MRT channels enter the same ISR, there is not priority concept for different MRT channels.

In the ISR, you have to check the MRT->IRQ_FLAG register to know the interrupt source and take action for different flag.

Assume two interrupt events of MRT module happen, the LPC82x will enter ISR, both flags in the MRT->IRQ_FLAG will be set, you can take action in the ISR for the two interrupt events

Hope it can help you

BR

XiangJun Rong

 

0 件の賞賛
返信
737件の閲覧回数
topspin
Contributor II

Hi @xiangjun_rong 

Ok I see now.

Is there the possibility to have the sct timer generating a pwm on a given pin with a given duty cycle and to have an interrupt triggered on the rising and falling edges of that pwm?

 

Best regarda

0 件の賞賛
返信
710件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Of course, only events can trigger interrupt for the SCT module.

You can set the corresponding bits in SCT->EVEN register to enable a specific event generate interrupt.

xiangjun_rong_0-1708695639910.png

Hope it can help you

BR

XiangJun Rong

0 件の賞賛
返信
674件の閲覧回数
topspin
Contributor II

Hi @xiangjun_rong 

Sorry for this follow up

so I will try to have the SCT timer creating a pwm and triggering an interrupt at each rising and falling edges of the pwm. Does the SCT timer have an interrput priority higher than the MRT timer? can I modify the priority order?

 

Best regards

0 件の賞賛
返信
666件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suggest you generate PWM with  edge-alignment mode, so the rising edge and falling edge are controlled by different events for SCTimer module. Each event can fire an interrupt.

As you know that the SCTimer is interrupt source, the MRT is another interrupt source, each interrupt source has an independent 8 bits interrupt priority register, so you can program each interrupt source priority by programming the 8 bits interrupt priority register.

You can program IPR2 to configure the SCT and MRT interrupt priority.

I copy from UM10800.pdf

xiangjun_rong_0-1709011199927.png

Hope it can help you

BR

XiangJun Rong

 

0 件の賞賛
返信
651件の閲覧回数
topspin
Contributor II

hi @xiangjun_rong 

This sounds a good way forward!

How can I evaluate the jitter of the SCT timer?  let's say that I would like to generate a 100Hz pwm with 30Mhz system clock. I set the ctrl and matchrel registers to get the 100Hz period

SCT0->CTRL|=(199<<5); // to get a 150kHz clock to SCT

SCT0->MATCHREL[0]=1500; // to get about 100Hz period

 

Which is the expected accurcay on the 100Hz frequency using the Internal IRC oscillator?

It seems that increasing the values of MATCHREL register increase the jitter of the PWM

 

Thanks 

Best regards

 

0 件の賞賛
返信
648件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The PWM signal clock frequency accuracy is solely dependent on the IRC clock frequency accuracy, which is used to drive SCT module via PLL or not.

 

This is IRC clock frequency accuracy 12MHz+/-0.15% for LPC82x.

If the output PWM is 100Hz, the jitter will be 100Hz*(+/-1.5%), in other words, ranging from 98.5Hz to 101.5Hz.

Hope it can help you

BR

XiangJun Rong

xiangjun_rong_0-1709087998604.png