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