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.

TMS470M HET Interrupts

Other Parts Discussed in Thread: HALCOGEN

Hi

How to use HET Interrupts by using CCS 5.4 and Halcogen?

How to configure Halcogen? Where i may see a example?

Regards, Roman

  • Roman,

    Do you want just edge triggered interrupt pins?  If so see the "EDGE0-7' and 'EDGE Interrupts" tabs in halcogen.

    If you want something else, then you're going to have to use a customized HET program and do some additional register settings through the header files that come with HalCoGen rather than using it's APIs.

    -Anthony

  • Hi Anthony,

    I want just edge triggered interrupt pins. 

    Give me please example code in CCS5.

    Regards, Roman

  • How to configure HET[x] pin? 

    I setting HET port pins to input, and set bit to high level, but physically on MCU pin low level... 

    My Halcogen settings:

  • Roman,

    I'm attaching a project as an example.   It's not a perfect example.  I didn't track down yet which interrupt level is being used for starters.  We've unfortunately got different numbering schemes for 'level'  (0 and 1, 1 and 2, and 'hi and lo') in our docs so for now I enabled both levels.

    Also, I don't have a convenient way to generate edges so I used the PWM interrupt instead.  But you should be able to adapt this to your edge example. (and probably a good exercise to try it).

    I was surprised to find that even though in the HalCoGen GUI you can select an interrupt based on a PWM or Capture, the template that adjusts the HET code to the HalCoGen GUI settings doesn't have the capability to change the HET instruction to generate the interrupt.  So I added this manually.

    Here is what I put in the main() function:

    You can load this program and put a breakpoint on the hetRAM->Instruction... line like I have in the picture above.

    It is after a very long delay and you should be able to see PWMs on pin het[8] during this time, but no interrupts.

    To see Interrupts, put a breakpoint here in the file notification.c :  this is the call-back function where you will eventually add your interrupt handler code.

    Also you might want to put a breakpoint here in the file het.c

    What I see is the following:

      1) no hits on the interrupt before the line 40 of sys_main.c is executed.  first break is on line 40.

          If you pause and watch the HET memory or HET registers you can see that the HET is running and

          in the HET GIO registers you can see that the pin is toggling (look at DIN change).

      2) run again after hitting the BP at line 40.  Now you will get breaks at the interrupt handler.

    The job that line 40 is doing is to change the 'Int enab' bit of the instruction's control ram field, so that an interrupt is requested by the HET instruction when the duty cycle is met.  The HET instructions have to generate the interrupt request themselves....

    Normally if you write your own HET program and run it through the HET IDE you'd have this coded into the program from the start.  Not sure the concept behind this canned example.  I'll check what the thought process is.

    Last, you can see that the +41u is added to the index of the pwm0 instruction.   This is a MOV64 instruction that *updates* the PWCNT instruction.

    If we were writing this code from scratch we'd probably have the interrupt enable set in both the original instruction at het instruction 0x2 *and* it's refresh instruction the MOV64 at the higher address configured for interrupt enable.

    I'm taking a bit of a shortcut here by only enabling the interrupt in the refresh instruction; but to illustrate the point that this bit setting is one of the missing pieces to see interrupts from HET with the HalCoGen example.    

    Don't worry yet if this seems obtuse... it is... so give it a shot and it'll become clearer.

    Last thing:  I included the .hcg project file so you can open it and inspect the screens like your question above.   Please also look at the screens for the VIM, as interrupts need to be enabled in the VIM as well as in the HET.

    2477.tms470m_het_interrupt.zip

  • Roman,

    A bit of an update.  I compared the driver template files for the TMS570 v.s. the TMS470M and found this difference:

    The template file for TMS570 has:

        /* MOV64: PWM 1 -> Duty Cycle Update
        *         - Instruction                  = 43
        *         - Next instruction             = 44
        *         - Conditional next instruction = 4
        *         - Interrupt                    = 3
        *         - Pin                          = %%HET2_PWM1_PIN_SELECT%%
        */
        {
            /* Program */
            0x00058203U,
            /* Control */
            (0x00008007U | (%%HET2_PWM1_ENA%%U << 22U) | (%%HET2_PWM1_PIN_SELECT%%U << 8U) | (%%HET2_PWM1_ACTION%%U << 3U)),
            /* Data */
            %%HET2_PWM1_DUTY_PRESCALER%%U,
                                    /* Reserved */
                                    0x00000000U
        },

     

    But the template for TMS470M has:

        /* MOV64: PWM 1 -> Duty Cycle Update
        *         - Instruction                  = 43
        *         - Next instruction             = 44
        *         - Conditional next instruction = 4
        *         - Interrupt                    = 3
        *         - Pin                          = %%HET_PWM1_PIN_SELECT%%
        */
        {
            /* Program */
            0x0002C103U,
            /* Control */
            (0x00004006U | (%%HET_PWM1_DUTY_INTENA%%U) | (%%HET_PWM1_ENA%%U << 20U) | (%%HET_PWM1_PIN_SELECT%%U << 7U) | (%%HET_PWM1_ACTION%%U << 3U)),

            /* Data */

            %%HET_PWM1_DUTY_PRESCALER%%U,

                                    /* Reserved */

                                    0x00000000U

    Note the relevant difference (highlighted in red).  This is the bit in the control field that determines whether an instruction requests an interrupt or not.

    In the TMS570 program, it appears all the instructions request interrupts, so your only control is the priority level and whether or not you enable notification.   You may not want to code your actual N2HET program this way -- I'd probably make only the instructions that I wanted to generate an interrupt have the interrupt enable bit set.

    But for this simple example, I think this is probably a bug in the template for TMS470M. I'll report it and see what the feedback is.

    Meantime you could edit the template if you want or you could just manually set the bit in main() like I did in the attachment to the previous post.

  • Hi

    FYI, this issue is fixed in the upcoming HALCoGen release 3.06.00 which is due 31st July 2013.

    Cheers,
    Prathap

  • Hi

    thank you for your help about pwm.

    How to use edge interrupts?

  • Hi

     i used your code in our project, all worked.  I tried this code use for edge interrupts, but not worked this.


    Please give me example for edge. I used extern source (both of rising and falling edge) for interrupt.


    Regards,

    Roman

  • Hi Roman,

    What changes did you make in order to enable the edge interrupt? 

    -Anthony

  • Hi Roman,

    Sorry for the inconvenience. 

    I generated the HET code with default enabling all Edge interrupts ( as below), Instruction 17 to 24 are used for Edge capture.

    There is a bug ( Even in latest HALCoGen 3.06.00 ) that ones highlighted in RED have to be 0x00000001 if interrupt Enabled or 0x00000000 if interrupt is disabled.

    PWM Period and Duty cycle interrupt issue was fixed in 3.06.00. 

    ---------------------------------------------------------------------------------------------------------------

    /* ECNT: CCU Edge 0
    * - Instruction = 17
    * - Next instruction = 18
    * - Conditional next instruction = 18
    * - Interrupt = 17
    * - Pin = 9
    */
    {
    /* Program */
    0x00012A20U,
    /* Control */
    (0x00012006U | (0x00020000U) | (9U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 1
    * - Instruction = 18
    * - Next instruction = 19
    * - Conditional next instruction = 19
    * - Interrupt = 18
    * - Pin = 11
    */
    {
    /* Program */
    0x00013A20U,
    /* Control */
    (0x00013006U | (0x00040000U) | (11U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 2
    * - Instruction = 19
    * - Next instruction = 20
    * - Conditional next instruction = 20
    * - Interrupt = 19
    * - Pin = 13
    */
    {
    /* Program */
    0x00014A20U,
    /* Control */
    (0x00014006U | (0x00080000U) | (13U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 3
    * - Instruction = 20
    * - Next instruction = 21
    * - Conditional next instruction = 21
    * - Interrupt = 20
    * - Pin = 15
    */
    {
    /* Program */
    0x00015A20U,
    /* Control */
    (0x00015006U | (0x00100000U) | (15U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 4
    * - Instruction = 21
    * - Next instruction = 22
    * - Conditional next instruction = 22
    * - Interrupt = 21
    * - Pin = 20
    */
    {
    /* Program */
    0x00016A20U,
    /* Control */
    (0x00016006U | (0x00200000U) | (20U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 5
    * - Instruction = 22
    * - Next instruction = 23
    * - Conditional next instruction = 23
    * - Interrupt = 22
    * - Pin = 21
    */
    {
    /* Program */
    0x00017A20U,
    /* Control */
    (0x00017006U | (0x00400000U) | (21U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 6
    * - Instruction = 23
    * - Next instruction = 24
    * - Conditional next instruction = 24
    * - Interrupt = 23
    * - Pin = 22
    */
    {
    /* Program */
    0x00018A20U,
    /* Control */
    (0x00018006U | (0x00800000U) | (22U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* ECNT: CCU Edge 7
    * - Instruction = 24
    * - Next instruction = 25
    * - Conditional next instruction = 25
    * - Interrupt = 24
    * - Pin = 23
    */
    {
    /* Program */
    0x00019A20U,
    /* Control */
    (0x00019006U | (0x01000000U) | (23U << 7U) | (1U << 4U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },

    ---------------------------------------------------------------------------------

    Regards
    Prathap 

  • Thank you very mutch! Work it.

    Regards,

    Roman