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.

tms470r1b1m HET interrupt problem

Other Parts Discussed in Thread: TMS470R1B1M

Hi guys

I'm using HET interrupt to toggle HET0..7 LEDs und my code is based on the example code from TI. However, it seems there is no interrupt happened. Can anyone tell me what might be the problem? Thanks in advance.

Here is my code:  

__no_init volatile HETPROGRAM0_UN e_HETPROGRAM0_UN @ 0x800000;

HET_MEMORY const HET_INIT0_PST[1] =
{

  /* L00_0 */
 {
  0x00000601,
  0x00002000,
  0x00000000,
  0x00000000
 }
};

void main(void)
{
  __disable_interrupt();
  PCR = CLKDIV_2;                                          // ICLK = SYSCLK / 2
  GCR = ZPLL_CLK_DIV_PRE_1;                    // SYSCLK = 8 x fOSC
  PCR |= PENABLE;                                          // Enable peripherals

  REQMASK = (1 << CIM_HET1);                     // Enable HET Interrupt mask

  HETGCR = CLK_MASTER + IGNORE_SUSPEND;         // HET Master Mode, Ignore SW BP

  // Copy HET instructions to HET RAM
  MemCopy32((void *) &e_HETPROGRAM0_UN, (void *) HET_INIT0_PST, sizeof(HET_INIT0_PST));


  HETPRY = 0x01;                                // Int on instruction 1 is
                                                                high-priority
  HETPFR = 0x0000052b;                     // Set PFR register 

  HETDCLR = 0xffffffff;                         // Clear HET output latches
  HETDIR = 0xffffffff;                          // Set HET as GIO outputs

  HETGCR |= ON;                                 // Start HET

  __enable_interrupt();                         // Enable Interrupts

  while (1);                                    // Loop forever...
}
//------------------------------------------------------------------------------
// This module programms the HET RAM with the HET code
//------------------------------------------------------------------------------
void MemCopy32(unsigned long *dst, unsigned long *src, int bytes)
{
  for (int i = 0; i < (bytes + 3) / 4; i++)
    *dst++ = *src++;
}
//------------------------------------------------------------------------------
// TMS470R1B1M Standard Interrupt Handler
//------------------------------------------------------------------------------

__irq __arm void irq_handler(void)
{
   switch((0xff & IRQIVEC)-1)
  {
   case CIM_HET1  : HET1_irq_handler(); break;

  }
}

//------------------------------------------------------------------------------
// HET Instruction 0 Interrupt Handler
//------------------------------------------------------------------------------

void HET_CNT_INT()
{
  HETDOUT ^= 0xff;                               // Toggle HET0..7 LEDs
}

//------------------------------------------------------------------------------
// HET Interrupt Handler
//------------------------------------------------------------------------------
void HET1_irq_handler()
{
  switch ((0xff & HETOFF1)-1)
  {
    case 0 :                                    // Instruction 0
      HET_CNT_INT();
      break;
  }

}

Actually, now i just copy the example code to check the problem, however the result is the same. Another thing is i can not insert breakpoint inside the interrupt functions. Does anyone know why? 

Rui

  • I have found that i have to include the cstartup.s79 and _low_level_init_flash.c. However, the _low_level_init_flash.c is included in another way from the EWARM IAR workbench example. Besides, i noticed that from application note SPNA104, there were template for each device and root list below main.c when you created a workspace and main file. Then after choosing the device from root list, the _low_level_init_flash.c will be automatically add to the project as the example code from EWARM IAR workbench. However, there is no such thing in my workbench but only a main.c. Does anyone know what might be the problem? Thanks

  • Hi

    I have forwarded your query to our expert.  

    Best Regards
    Prathap

     

  • Thanks Prathap

    I met another problem now. I use the exactly the same code in different kickstart versions 4 and 6. The code is running well under the version 4. However there is no interrupt at all when the code is running under the version 6. Does anyone here know what should i change when i switch to different version besides the code? Thanks

    Rui

  • Hi Rui,

        You might have the problem solved already.

        I hope this may help somehow to resolve some of your problems.

     

        The following modification is needed for the interrupt handler to work fine under the version 6:

    __irq __arm void irq_handler(void)          --> changed to -->       __irq __arm void IRQ_Handler()

        This is because the change of function declaration in the version 6.

     

     

     

    Best Regards,

    Soo

     

  • Thanks a lot Soo. I didnt solve the problem yet, as I realize that V.6's code size limit (32K) is still not enough for my project. I will try the modification later on to see whether it works.

    Rui