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.

CCS/TMS570LS3137: Timer and Interrupt based on TMS570LS3137

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I am a newer.

I want to know that how to create a Timer (eg 1ms) in the program based on TMS570LS3137 HDK?

For example, I want to send CAN message every 100ms by the timer (Ton).

  • Hello,
    You can use RTI module to generate interrupt every 1ms. To do this you have to set RTI module in HALCoGen (under "RTI" Tab). Also, RTI Compare interrupt must be enabled (under "VIM Channel 0-31" tab).
    Example how to do this could be found in "example_rtiBlinky.c" which is in ..\ti\Hercules\HALCoGen\v04.07.00\examples\TMS570LS31x_21x\ folder.
    Detailed explanation of how to set HALCoGen to use the example could be found in Help-->Help topics->Examples menu.

    Best regards,
    Miro
  • Hello,

    Firstly, thank you for your reply.

    I have seen the RTI module in HALCoGen,but because I don't know how to set many related parameters.

    Can you create an simple example(1 ms) for me.(Including HALCoGen file and CCS files) .

    And using it to send one CAN message.

    Thank you very much.

  • I have seen the RTI module in HALCoGen,but because I don't know how to set many related parameters.
  • Hello,
    Did you see the example code "example_rtiBlinky.c" under example folder of HALCoGen? This code makes LED to blink every 1s.
    Also, detailed explanation how to set HALCoGen for this example could be found after open/create HALCoGen project with an TMS570LS3137 MCU. After open/create project, go to Help-->Help Topict menu. Then, from left side click on Examples and from right side select example_rtiBlinky.c . In Step 4, "Compare 0 Period" is where period for LED to toggle is set (In this example it is set to 1000 ms).

    In "example_rtiBlinky.c" ISR rtiNotification, is where GIO ( where LED is connected.) is toggled. rtiNotification is called every 1000ms (set in step 4).

    You can change Compare 0 Period and rtiNotification could be modified to send CAN message.

    In examples you can find how to use CAN module, as well.

    Best regards,
    Miro
  • Thank you for your reply.
    Before, I forgot to enable the RTI Compare0 in the channel map.
    Now, everything work normally.