Loading ...
Sorry, an error occurred while loading the content.

251Re: [TMS470_ARM] Het can't interrupt CPU

Expand Messages
  • JohnStosh
    Feb 27, 2009
      Dear  incredibleengine,

      Is .br for Brazil?  You do any Java?

      Here are some ideas on your trouble.

      Make sure you're compiling for debug (no optimizations) so that you can expect your breakpoint to be hit.

      I have this "no interrupt" trouble if I do
         REQMASK=(1 << CIM_HET1); // Enable HET Interrupt mask
      for two different interrupts.  Then the = of the second turns off the bit for the first.  So using |= instead of = is the usual practice.  You might search your code to see if you're changing REQMASK somewhere else.

      The HET is tough to use.   You can divide and conquer your problem.  Try getting an interrupt working from another example and see if your bug is just with making interrupts work. Then you can come back to interrupts from the HET.

      Another suggestion is to look at all the registers you've set up in your code and see if they (still) have the correct values in them.  This is very easy to do with IAR because it will let you directly view and change all the registers.

      Look at your link map and make sure the vectors are being placed correctly.  Are you compiling into RAM or FLASH?  Where are your vectors?

      Lastly, look for where you have changed the example code and/or try a different example.  Is the project configuration part of the example?  Is something in the project set up wrong?

      :-)  Interrupts work for me  :-)
      Well, I'm using a TMS470r1b1m though ...
      -Stosh

      --- On Fri, 2/27/09, incredibleengine <incredibleengine@...> wrote:

      From: incredibleengine <incredibleengine@...>
      Subject: [TMS470_ARM] Het can't interrupt CPU
      To: TMS470_ARM@yahoogroups.com
      Date: Friday, February 27, 2009, 8:34 AM

      Hi all!

      It's my first steps with TMS470A256's HET and I can't do HET interrupt
      CPU. I'm doing a very simple test code from TI website that should
      create a

      virtual counter and, when it reaches it's maximum, generate an
      interrupt. I guess it should be a silly thing but I can't figure out
      what it is. Any

      idea? Any help or comments will be welcome! (the code is below)

      Thanks a lot!

      obs:
      - I'm using the exact TI example with the same eval board.
      - Eval board is working fine. Sysclock is sampled correctly at CLKOUT pin.
      - C Compiler.
      - PLL Disabled (XTAL = 12 MHz).
      - Environment: IAR Embedded Workbench 5
      - Debugger: J-Link.
      - No error or warning messages.
      - Another TI example, which generate PWM pulses in two pins, works
      fine. (but this one don't uses interrupt).
      - Custom build command copied from TI user guide: het470 -hc
      "$FILE_PATH$ " "$FILE_BPATH$ "

      .het file
      ############ ######### ######### ######### ######### ######### ######### ######### ######### #########
      L00: CNT {next=L00, reg=A, irq=ON, max=0x2000, data=0}

      main.c
      ############ ######### ######### ######### ######### ######### ######### ######### ######### #########

      __no_init volatile HETPROGRAM0_ UN e_HETPROGRAM0_ UN @ 0x00800000;

      void MemCopy32(unsigned long *dst, unsigned long *src, int bytes);
      void HET_CNT_INT( );
      void HET1_irq_handler( );

      void main(void)
      {
      // Set up peripheral registers.

      PCR = CLKDIV_1; // ICLK = SYSCLK/4
      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; // enable interrupt for
      instruction 1
      HETPFR = 0x0000052b; // Set PFR register

      HETDIR = 0xFFFFFFFF; // Set all HET as GIO outputs
      HETDOUT = 0xFFFFFFFF; // Flash all leds off and on
      and off

      HETGCR |= ON; // Start HET

      __enable_interrupt( ); // Enable Interrupts

      while(1);
      }

      //---------- --------- --------- --------- --------- --------- ---
      // 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++;
      }

      //---------- --------- --------- --------- --------- --------- ---
      // TMS470R1A256 Standard Interrupt Handler
      //---------- --------- --------- --------- --------- --------- ---
      __irq __arm void IRQ_Handler( )
      {
      switch((0xff & IRQIVEC)-1) //>>>> Breakpoint is not reached here!
      <<<<<
      {
      case CIM_HET1 :
      HET1_irq_handler( );
      break; // Check for the HET interrupt
      }
      }

      //---------- --------- --------- --------- --------- --------- ---
      // Flash the LED code
      //---------- --------- --------- --------- --------- --------- ---
      void HET_CNT_INT( )
      {
      HETDOUT ^= 0xFFFFFFFF; // Flash LEDs
      }

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


    • Show all 5 messages in this topic