Error in Multi-Rate Timer (MRT) with multiple channel

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

Error in Multi-Rate Timer (MRT) with multiple channel

ソリューションへジャンプ
1,997件の閲覧回数
hemanthvasista
Contributor IV

Hello ,

I am working on the LPC546xx based device. I tried using Multi-Rate Timer (MRT) with multiple channel.

When I configure either of one channel, they work fine individually.
But when I enable both channel, channel-0 is interrupted at different time and no interrupt is generated on channel-1.

Below is code snippet

    /* mrtConfig.enableMultiTask = false; */
    MRT_GetDefaultConfig(&mrtConfig);

    /* Init mrt module */
    MRT_Init(MRT0, &mrtConfig);

    /* Setup Channel 0 to be repeated */
    MRT_SetupChannelMode(MRT0, kMRT_Channel_0, kMRT_RepeatMode);
    MRT_SetupChannelMode(MRT0, kMRT_Channel_1, kMRT_RepeatMode);

    /* Enable timer interrupts for channel 0 */
    MRT_EnableInterrupts(MRT0, kMRT_Channel_0, kMRT_TimerInterruptEnable);
    MRT_EnableInterrupts(MRT0, kMRT_Channel_1, kMRT_TimerInterruptEnable);

    /* Enable at the NVIC */
    EnableIRQ(MRT0_IRQn);

    MRT_StartTimer(MRT0, kMRT_Channel_0, 22000);       //100us interrupt
    MRT_StartTimer(MRT0, kMRT_Channel_1, 220000); //1ms interrupt

The ISR is as below:

void MRT0_IRQHandler(void)
{
    if(MRT_GetStatusFlags(MRT0, kMRT_Channel_0))
    {
        MRT_ClearStatusFlags(MRT0, kMRT_Channel_0, kMRT_TimerInterruptFlag);
        APP_LED_TOGGLE;
    }
    else if (MRT_GetStatusFlags(MRT0, kMRT_Channel_1))
    {
        MRT_ClearStatusFlags(MRT0, kMRT_Channel_1, kMRT_TimerInterruptFlag);
        APP_LED_TOGGLE_1;
    }

/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
  exception return operation might vector to incorrect interrupt */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
    __DSB();
#endif
}

regards,
Hemanth

ラベル(2)
タグ(2)
0 件の賞賛
返信
1 解決策
1,906件の閲覧回数
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Hemanth S

 

When channel 1 interrupts channel 0 also gets the interruption. I suggest you add a counter in the interruption on channel 0, when it reaches 1ms, the interruption of the channel 0 is disabled with "MRT_ClearStatusFlags" in order to enter the interruption of channel 1.

Another thing I can suggest is to do this comparison in the "if" sentence

If( 0x3 == MRT_GetStatusFlags(MRT0, kMRT_Channel_0) )

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

元の投稿で解決策を見る

2 返答(返信)
1,907件の閲覧回数
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Hemanth S

 

When channel 1 interrupts channel 0 also gets the interruption. I suggest you add a counter in the interruption on channel 0, when it reaches 1ms, the interruption of the channel 0 is disabled with "MRT_ClearStatusFlags" in order to enter the interruption of channel 1.

Another thing I can suggest is to do this comparison in the "if" sentence

If( 0x3 == MRT_GetStatusFlags(MRT0, kMRT_Channel_0) )

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

1,906件の閲覧回数
hemanthvasista
Contributor IV

Thanks for you inputs Omar.

Add of the below line solved the issue:

If( 0x3 == MRT_GetStatusFlags(MRT0, kMRT_Channel_0) )

regards,

Hemanth

0 件の賞賛
返信