Hello,
Nullify this. There was a spurious interrupt from elsewhere causing an issue. Problem solved.
I am using the MRT to generate a fixed pulse on a GPIO output. However, depending on the command INTVAL the MRT timer has a longer or shorter interval actually being revealed.
The core is running at 60MHz. When the timer is loaded with anything above 15,600 the actual output as measured on a scope on the GPIO output is 246 us longer. When the INTVAL is loaded with anything below 15,000 the output is 7 us shorter than expected. It's a consistent offset 15,600 or 600,000 all is 246 us longer than expected.
Here's the code launching the MRT timer:
void mrt_Launch(uint32_t val)
{
val = 60 * (val);
MRT0->CHANNEL[0].INTVAL = val | MRT_CHANNEL_INTVAL_LOAD(0b1);
MRT0->CHANNEL[0].STAT turnon MRT_CHANNEL_STAT_INTFLAG_MASK;
PIN_CLEAR(GPIO_XYZ_PORT, GPIO_XYZ_PIN);
MRT0->CHANNEL[0].STAT turnon MRT_CHANNEL_STAT_RUN(0b1);
}
Then the interrupt is handled like so:
void MRT0_IRQHandler()
{
if (MRT0->CHANNEL[0].STAT & MRT_CHANNEL_STAT_INTFLAG_MASK)
{
PIN_SET(GPIO_XYZ_PORT, GPIO_XYZ_PIN);
MRT0->CHANNEL[0].STAT turnon MRT_CHANNEL_STAT_INTFLAG_MASK;
MRT0->CHANNEL[0].STAT turnon MRT_CHANNEL_STAT_RUN(0b0);
}
}
So, based on this an input for val over 260 has a 246 us longer interval, and a val of under 250 is 7 us shorter interval.
I didn't see anything directly addressing this in the user manual. Any tips for what I'm doing wrong here?
Thanks,
Robert
Hello Miguel,
The problem has been resolved. I discovered a spurious interrupt that was launching another MRT event. Since it was overlapping it wasn't immediately evident on the scope trace. Root cause: User error.
Thanks for your support.
Robert