• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » Code Composer Studio » Code Composer Forum » ILLEGAL_ISR instead function using PID library with CCS 4
Share
Code Composer Studio
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Common Questions
  • Code Composer Studio Forum Usage Guidelines

  • Resources
  • Code Composer Studio (CCStudio) Product Folder
  • Troubleshooting CCS
  • CCS Wiki
  • Download CCS
  • Order CCS
  • Tools Insider Blog
  • Bug Tracking
  • Forums

    ILLEGAL_ISR instead function using PID library with CCS 4

    This question is answered
    Loriano Galeotti
    Posted by Loriano Galeotti
    on Jan 15 2010 08:51 AM
    Prodigy240 points

    Hello!

    I'm trying to tranin with CCS 4 ( 4.0.2.01003 ) for a stepper motor driving application.

    I'm using Piccolo experimental kit with 28035 processor, connected with a custom power board. I started from Piccolo-B header e peripheral control library, sprc892, to gain acces to various modules. In particular, I've PWM and ADC running.Then I tried to use PID library, with no success.

    I loaded "${workspace_loc:/iqDMC_ml}" as project in workspace and compiled as library.

    I included math functions folders in c2000 compiler -> include options

    "${workspace_loc:/iqDMC_ml}"

    "C:\TI_F28xxx_SysSW\~SupportFiles\lib\DMClib\cIQmath\include"

    "C:\TI_F28xxx_SysSW\~SupportFiles\lib\IQmath\cIQmath\include"

    and included library in c2000 linker->file search path > include library file as input box

    "${workspace_loc:/iqDMC_ml/Debug/iqDMC_ml.lib}"

    (it worked well with 2xPM_Motors demo)

    then I Added .h

    #define GLOBAL_Q 15 /* Set the Local Q value */
    #include "IQmathlib.h"
    #include "pid_reg3.h"

    initialized pid in main

       // init pid
       pid1.Kp = _IQ(0.5); // Pass _iq parameters to pid1
    pid1.Ki = _IQ(0.001); // Pass _iq parameters to pid1
    pid1.Kd = _IQ(0.01); // Pass _iq parameters to pid1
    pid1.Kc = _IQ(0.9); // Pass _iq parameters to pid1

    then I use pid in a function called in an ISR

                 pid1.Ref = _IQ(0.2); // Pass _iq inputs to pid1
                pid1.Fdb = _IQ(0.15); // Pass _iq inputs to pid1
                pid1.calc(&pid1); // Call compute function for pid1

    At pid1.calc it don't run the right funcion, but I fall in  ILLEGAL_ISR

    Any suggestion?

    Regards, Loriano.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Loriano Galeotti
      Posted by Loriano Galeotti
      on Feb 08 2010 09:54 AM
      Verified Answer
      Verified by JohnS
      Prodigy240 points

       

      I found a solution.

       

      Thanks however.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • kfmuzik
      Posted by kfmuzik
      on Mar 13 2010 03:37 AM
      Prodigy80 points

      hi,Loriano Galeotti

      I'm confronting the same problem ,could you be kind enough to tell me how you solve this tricky problem?

      Could you send me a mail to kfmuzik@126.com  with the solution to this problem?

      Thanks a lot!

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Loriano Galeotti
      Posted by Loriano Galeotti
      on Mar 15 2010 03:50 AM
      Prodigy240 points

      If I remember well, I did a mistake in function for cla code copy.

      You must copy your CLA code to RAM at runtime using a function like these in your code:

      // Copy time critical code and Flash setup code to RAM
      // This includes the following ISR functions: cla1_isr7 and InitFlash();
      // The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
      // symbols are created by the linker. Refer to the F2808.cmd file.
      //
        MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

      // copy CLA functions to RAM
        MemCopy(&Cla1funcsLoadStart, &Cla1funcsLoadEnd, &Cla1funcsRunStart);   

      I used linker command file from example  cla_adc_fir_flash in   2803x C/C++ Header Files and Peripheral Examples Quick Start  - Version 1.21

      http://focus.ti.com/docs/toolsw/folders/print/sprc892.html

      I hope it helps.

      Bye, Loriano.


      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • kfmuzik
      Posted by kfmuzik
      on Mar 15 2010 04:20 AM
      Prodigy80 points

      Hi,Loriano,

      thanks for your timely advice, but could you be kind enough to tell  me what is ' CLA functions'? Could you give me a example or tell me where i can find this function?

      Best wishes!

       

      kfmuzik

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Loriano Galeotti
      Posted by Loriano Galeotti
      on Mar 16 2010 03:01 AM
      Prodigy240 points

      Hi !

      I like when people help me so I try to help people when I can :)

      However, I think you are talking about "RamfuncsLoadStart" and the other constants used from MemCopy.

      These are defined in the linker commad file. I'ven't investigated too much how it works, just taken from the example :) .  If you install the sprc892  use the example

      C:\tidcs\c28\DSP2803x\v121\DSP2803x_examples_ccsv4\cla_adc_fir_flash

      constants are correctly set from the F28035_CLA_lnk.cmd linker commad file. You have just to include it in project, set the compiler switch to use the CLA (howto is written somewhere in the forum or wiki page) and in the main use the memcopy funcs, configure CLA (see the following), and it should work. 

        EALLOW;  // This is needed to write to EALLOW protected register
        
      // configure cla
         Cla1Regs.MVECT1 = (Uint16) (&Cla1Task1 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT2 = (Uint16) (&Cla1Task2 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT3 = (Uint16) (&Cla1Task3 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT4 = (Uint16) (&Cla1Task4 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT5 = (Uint16) (&Cla1Task5 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT6 = (Uint16) (&Cla1Task6 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT7 = (Uint16) (&Cla1Task7 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MVECT8 = (Uint16) (&Cla1Task8 - &Cla1Prog_Start)*sizeof(Uint32);
         Cla1Regs.MPISRCSEL1.bit.PERINT2SEL = CLA_INT2_ADCINT2; // ADCINT2 starts Task 2
         Cla1Regs.MPISRCSEL1.bit.PERINT3SEL = CLA_INT3_ADCINT3; // ADCINT3 starts Task 3
         Cla1Regs.MMEMCFG.bit.PROGE = 1;          // Map CLA program memory to the CLA
         Cla1Regs.MCTL.bit.IACKE = 1;             // Enable IACK to start tasks via software

       

      ... of course.. I suggest to start from example, it would be easier :)

      Bye, Loriano.

       

       

      CLA
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use