This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G1507: TIMA0 behaving differently in up and down counting mode

Part Number: MSPM0G1507
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi, I am using TIMA1 to start TIMA0 via cross-triggering. Both timers are set to one-shot down counting, and it works well. I toggle a GPIO at the Zero events of TIMA1 and at the Zero interrupt of TIMA0, so I can see the timer periods. I also use the TIMA0 Zero interrupt to restart TIMA1. So it's a continuous loop.

I would now like to use TIMA0 in up counting mode, so I can more easily use it to measure the elapsed time for something else. So I set it to one-shot up counting, and use the Load interrupt instead to toggle the GPIO and restart TIMA1. To ensure the count starts from 0, I also set the CVAE bit to 2 manually, since there is an issue with the dl_timer.c. Now, the TIMA0 interrupt triggers within 2us no matter what LOAD value I choose.

Interestingly, I can use TIMA1 in up counting mode and the behaviour is as expected.

Is there something else I'm missing?

  • Hi,

    This is weird. The TIMA0 and TIMA1 should be the same. If you are using the same configuration on those 2 timers, they should behave the same. Do not have any idea on why the TIMA1 can work with the up counting mode and TIMA0 can't. It feels weird on my side. 

    Best regards,

    Cash Hao

  • Hi, I've worked on this a bit further. You can see that the 2 timers trigger each other to start in the ISR. This is fine, and the LED blinks at the expected timing. I can configure TwindowTimer as both up-counting (interrupt at LOAD) and down-counting (interrupt at ZERO) and get the same behaviour.

    However, when I make TcloseTimer crosstrigger TwindowTimer, Twindow must be configured only as down-counting (interrupt on ZERO event) to have correct behaviour. When configured as up-counting and interrupt on LOAD event, it seems to trigger the interrupt immediately. Is there something I'm missing? I remembered to stop remove the startCounter in the IRQ:

  • Hi,

    You have also changed the interrupts configuration accordingly in Sysconfig right? Since the interrupt routine you showed will operates on any interrupt triggers. 

    Best regards,

    Cash Hao

  • Yes, interrupts are updated accordingly.

  • Okay. Do not have much clue here. I suppose using the timer in down counting mode would be a workaround for you. 

    Best regards,

    Cash Hao