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.

AM2634: Timer reconfiguration on run time

Part Number: AM2634
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Dear Team,

I want to use timer with Timer over flow interrupt enable feature, and timer need to reconfigure(for any time) start/stop in run time,

So please let me know which timer help me out to achieve my requirement,

Currently RTI_0 timer using but its difficult to reconfigure the timer in run time, 

So please suggest  

  • Hello,

    Can you explain how you are trying to reconfigure the timers during run time?

    Thank you,

    Susan 

  • while generate the code from sysconfig timer's interrupt time fixed as user defined time

    In run time timer's time need to change from 100us to 90us. Timer configuration settings are in TI_driver_open_close.c file

    and this file is not changeable by user.

    So please let me know how to change timer's time in run time.   

  • Hello,

    The TI_driver_open_close.c file is generated by SysConfig, which is why you cannot edit it.
    You can reconfigure the compare event by copying the code block above into your main code and replacing

    CONFIG_RTI0_NSEC_PER_TICK_COMP0 with 90000u
    and 
    CONFIG_RTI0_USEC_PER_TICK_COMP0 with 90u

    This should allow you to change the interrupt time.
    Thank you,
    Susan
  • Do I need to close the driver and reopen the driver after update CONFIG_RTI0_NSEC_PER_TICK_COMP0 value?

    because only change CONFIG_RTI0_NSEC_PER_TICK_COMP0 in main code will not work, more changes required.

    please try your self and let me know 

  • Hello,

    CONFIG_RTI0_NSEC_PER_TICK_COMP0 is a defined value, so you cannot change it in your code. You would have to use a new variable instead.

    I will try and provide an example on Monday.

    Thank you,

    Susan

  • Hello,

    I realized while working on this I may have made it more complicated than it needs to be. 
    To make sure I understand correctly, you are using one interrupt for 100us for a duration, then needing to change that interrupt to 90us after that?

    If that is correct, then an easier way to do this is to set up 2 separate compare events in SysConfig, one at 100us and one at 90us, then disabling the one you do not need until you switch.

    Disabling Compare1 (Interrupt 2):

    (void)RTI_intDisable(CONFIG_RTI0_BASE_ADDR, RTI_TMR_INT_INT1_FLAG);

    Disabling Compare0 (Interrupt 1) and Enabling Compare1 (Interrupt2):

    (void)RTI_intDisable(CONFIG_RTI0_BASE_ADDR, RTI_TMR_INT_INT0_FLAG);
    (void)RTI_intEnable(CONFIG_RTI0_BASE_ADDR, RTI_TMR_INT_INT1_FLAG);

    If you need to continuously keep changing your interrupt time (to several different values) I will need to check on manual interrupt configuration and how that works with SysConfig.

    Thank you,

    Susan