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

Re: [TMS470_ARM] Het can't interrupt CPU

Expand Messages
  • JohnStosh
    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
    Message 1 of 5 , Feb 27, 2009
    • 0 Attachment
      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
      }
      }


    • incredibleengine
      Hi Stosh! Thanks for your response, now I m sure the code doesn t have any terrible mistake. I stoped trying to make het work for a while and started to code
      Message 2 of 5 , Mar 3, 2009
      • 0 Attachment
        Hi Stosh!
        Thanks for your response, now I'm sure the code doesn't have any
        terrible mistake. I stoped trying to make het work for a while and
        started to code for other peripherals. When I finish with them I'll
        return to HET... About your ideas:

        - The project it's been compiled dor debug.
        - The REQMASK is correct. This is used just once in code.
        - I have other modules working fine (CAN, RTI, ADC)... Even HET worked
        with a PWM code, but without interrupting CPU. It seems to me that the
        unique trouble is HET irq!
        - Registers are correct!
        - I took a look at link map, but sincerely, I don't have enough
        knowledge to be sure it's correct... Do you have any docs about it?
        I've compared it with another files and it seems to be ok...
        - I used the same project configuration options for other projects and
        everything worked fine...
        - No optimizations are turned on (This is the first configuration that
        I set in any project! I've had some traumas with this in other
        plataforms! :))

        Thanks so much for your response. When I get news I'll post here...

        Yes! .br from Brazil. I do some java, but just little codes when I
        need to program for PC... Why do you ask?

        regards!

        >
        > 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
      • JohnStosh
        I hear Java is big in Brazil.  What smart people. I love Java.Have you checked the errata? ... From: incredibleengine Subject:
        Message 3 of 5 , Mar 3, 2009
        • 0 Attachment
          I hear Java is big in Brazil.  What smart people. I love Java.
          Have you checked the errata?

          --- On Tue, 3/3/09, incredibleengine <incredibleengine@...> wrote:

          From: incredibleengine <incredibleengine@...>
          Subject: [TMS470_ARM] Re: Het can't interrupt CPU
          To: TMS470_ARM@yahoogroups.com
          Date: Tuesday, March 3, 2009, 5:32 AM

          Hi Stosh!
          Thanks for your response, now I'm sure the code doesn't have any
          terrible mistake. I stoped trying to make het work for a while and
          started to code for other peripherals. When I finish with them I'll
          return to HET... About your ideas:

          - The project it's been compiled dor debug.
          - The REQMASK is correct. This is used just once in code.
          - I have other modules working fine (CAN, RTI, ADC)... Even HET worked
          with a PWM code, but without interrupting CPU. It seems to me that the
          unique trouble is HET irq!
          - Registers are correct!
          - I took a look at link map, but sincerely, I don't have enough
          knowledge to be sure it's correct... Do you have any docs about it?
          I've compared it with another files and it seems to be ok...
          - I used the same project configuration options for other projects and
          everything worked fine...
          - No optimizations are turned on (This is the first configuration that
          I set in any project! I've had some traumas with this in other
          plataforms! :))

          Thanks so much for your response. When I get news I'll post here...

          Yes! .br from Brazil. I do some java, but just little codes when I
          need to program for PC... Why do you ask?

          regards!

          >
          > Dear  incredibleengin e,
          > 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


        • incredibleengine
          Hi Stosh! Finally I got HET IRQ working! There were two problems: - Board s crystal is not welded on board! It s just attached with sockets. It s difficult to
          Message 4 of 5 , Mar 5, 2009
          • 0 Attachment
            Hi Stosh!

            Finally I got HET IRQ working!

            There were two problems:

            - Board's crystal is not welded on board! It's just attached with sockets. It's difficult to perceive that due to very short crystal pins! Due to that or crystal "quality" the oscillator was intermitent and seems to work better when scope probe was in contact with it... I just replaced 12MHz to a 6MHz crystal and oscillation problems was solved.
            Ok, I know they would done that to allow easy crystal replacement but I think it drives to many problems... I guess every crystal should be WELL welded (have had many problems with that).

            - "Low_level_flash_init" file was present at IAR Workspace Window but it wasn't been builded! It was marked as "Exclude from Build".
            All other peripherals (ADC, RTI, CAN, SPI) worked without this file because they don't use RAM memory. But HET needs proper memory intialization contained inside this file!

            Well, I'm relieved to have this working! Thanks for your attention and time trying to help me!

            About Java:
            Yes, there are many Java developers here. I like java too, it's ideas helped me to code better even for C, C++ and embedded software!

            regards!


            --- In TMS470_ARM@yahoogroups.com, JohnStosh <johnstosh@...> wrote:
            >
            > I hear Java is big in Brazil.  What smart people. I love Java.Have you checked the errata?
          Your message has been successfully submitted and would be delivered to recipients shortly.