• 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 » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » sine function with ezdsp f28335
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • sine function with ezdsp f28335

    sine function with ezdsp f28335

    This question is not answered
    tequila
    Posted by tequila
    on Jan 11 2009 13:41 PM
    Prodigy100 points

    hi all,

    i am newbie in dsp,i use ezdsp 28335.
    i have few questions.
    the first question:

    I use ezdsp f28335 floating point to controll AC motor.so i want to use the sine function
    defined in "math.h".i have included "the math.h" but the ccs 3.3 says:

    ......
    <Linking>

     undefined  first referenced
      symbol        in file
     ---------  ----------------
     _Cos       D:\\Programme\\MyProjects\\RL_3phase\\Debug\\park_sinus.obj
     _Sin       D:\\Programme\\MyProjects\\RL_3phase\\Debug\\park_sinus.obj
     _park_calc D:\\Programme\\MyProjects\\RL_3phase\\Debug\\RL_3phase.obj
    .....

    what should i do?should i use sine lookup table?which way is better?

    the second question:
    like matlab operation, when i delare variable so :     float32 : a,x,y,z;

    then can i do without IQmath so ??:                             z = a*x + y; also like in matlab?

    the third question:
    what does the rts2800_fpu32_eh library do?

     

    thanks!:):):)

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Johannes L.
      Posted by Johannes L.
      on Jan 13 2009 03:09 AM
      Intellectual875 points

      tequila

      hi all,

      i am newbie in dsp,i use ezdsp 28335.
      i have few questions.
      the first question:

      I use ezdsp f28335 floating point to controll AC motor.so i want to use the sine function
      defined in "math.h".i have included "the math.h" but the ccs 3.3 says:

      ......
      <Linking>

       undefined  first referenced
        symbol        in file
       ---------  ----------------
       _Cos       D:\\Programme\\MyProjects\\RL_3phase\\Debug\\park_sinus.obj
       _Sin       D:\\Programme\\MyProjects\\RL_3phase\\Debug\\park_sinus.obj
       _park_calc D:\\Programme\\MyProjects\\RL_3phase\\Debug\\RL_3phase.obj
      .....

      what should i do?should i use sine lookup table?which way is better?

      This looks as if you have declared Cos() and Sin() (with capital first letter) and park_calc() but haven't defined them.

      I'd suggest using the functions cos() and sin() from the standard library. They are declared in math.h.

      With an FPU available I woudn't want to use a lookup table.

      tequila

      the second question:
      like matlab operation, when i delare variable so :     float32 : a,x,y,z;

      then can i do without IQmath so ??:                             z = a*x + y; also like in matlab?

      I don't know whether I understand your question...

      The following can be done in C:

      float a, x, y, z;

      /* initilize a, x, y, z with meaningful values */

      z = a*x + y;

      Of course, a, x, y, z are scalars while in matlab vectors or matrices are possible.

      tequila
      the third question:
      what does the rts2800_fpu32_eh library do?

      That's the standard library (which contains, among other things, the implementation of sin() and cos()).

      I don't know, what _eh stands for (in my application I use rts2800_fpu32).

       

      Johannes

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • tequila
      Posted by tequila
      on Jan 14 2009 05:46 AM
      Prodigy100 points

      thanks Johannes :-)

      Johannes

      This looks as if you have declared Cos() and Sin() (with capital first letter) and park_calc() but haven't defined them.

      I'd suggest using the functions cos() and sin() from the standard library. They are declared in math.h.

      With an FPU available I woudn't want to use a lookup table.

      yes i want to use functions cos() and sin() from the standard library too,but how? so i have configured in project-option:

      linker:

      -x -i"C:\CCStudio_v3.3\C2000\cgtools\lib"

      -l"rts2800_fpu32.lib"

      compiler:

      -i"E:\Programme\MyProjects\RL_3phase\DSP2833x_headers\include"

      -i"E:\Programme\MyProjects\RL_3phase\DSP2833x_common\include"

      -i"C:\CCStudio_v3.3\C2400\cgtools\include"  /* math.h in this*/

      and in prroject management window : in "labraries" folder i have added" rts2800_fpu32.lib".

      but ccs says the same error message :(

      Johannes

      I don't know whether I understand your question...

      The following can be done in C:

      float a, x, y, z;

      /* initilize a, x, y, z with meaningful values */

      z = a*x + y;

      i think with ploating point DSP can i use oparations such as multiplication, addition,division..without IQmath library?

      tequila

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • HTrudel
      Posted by HTrudel
      on Jan 14 2009 09:55 AM
      Prodigy200 points

      tequila
      -x -i"C:\CCStudio_v3.3\C2000\cgtools\lib"

      tequila
      -i"C:\CCStudio_v3.3\C2400\cgtools\include"  /* math.h in this*/

      I'm not sure about this but I think your include search path and link libraries should match, i.e. use the C2000 one (C2400 is not a floating point DSC).  Also note that if you upgrade the code generation tool in another directory, you should point to that directory instead.  The path in your example is for the default code generation tools location.

      I myself installed the newest code generation tools version in C:\CCStudio_v3.3\C2000\v5.1.2 (instead of the default location of c:\program files\... because CCS export to makefile does not like spaces in the path).

       

      FYI, I found out in SPRUEO2A that the difference between the rts2800_fpu32.lib and rts2800_fpu32_eh.lib is that the _eh version includes exception handling code for C++ exceptions.  I think that if you do not use throw, catch, you do not require to use the _eh library.

      Regards,

       

      Hugo Trudel
      Software Eng. - Embedded Systems Specialist
      Rheinmetall Canada

      compiler F2833x CCS linker
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • tequila
      Posted by tequila
      on Jan 14 2009 11:49 AM
      Prodigy100 points

      thanks u,

      i have upgraded to Code Generation Tools 5.1.0 but not better.

      linker:

      -x -i"C:\Programme\C2000 Code Generation Tools 5.1.0\lib"

      -l"rts2800_fpu32.lib"

      compiler

      -i"H:\Hoang\DSP\MyProjects\RL_3phase\DSP2833x_headers\include"

      -i"H:\Hoang\DSP\MyProjects\RL_3phase\DSP2833x_common\include"

      -i"C:\Programme\C2000 Code Generation Tools 5.1.0\include"  /*math.h in this*/

      in source code: ipark_sinus.c

      #include "ipark_sinus.h"
      #include <math.h>

      void ipark_sim_calc(IPARK_SIM *v)
      {   
            v->Alpha = v->Ds*Cos(v->Angle) - v->Qs*Sin(v->Angle);     /* line 13 in warning message*/
           v->Beta = v->Qs*Cos(v->Angle) + v->Ds*Sin(v->Angle); 
      }

      but the same error:

      ccs says:

      ..................................

        "ipark_sinus.c", line 13: warning: function declared implicitly

      [Linking...] "C:\Programme\C2000 Code Generation Tools 5.1.0\bin\cl2000" -@"Debug.lkf"
      <Linking>

       undefined first referenced                                            
        symbol       in file                                                 
       --------- ----------------                                            
       _Cos      H:\\Hoang\\DSP\\MyProjects\\RL_3phase\\Debug\\ipark_sinus.obj
       _Sin      H:\\Hoang\\DSP\\MyProjects\\RL_3phase\\Debug\\ipark_sinus.obj

      error: unresolved symbols remain
      error: errors encountered during linking; "./Debug/RL_3phase.out" not built

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Johannes L.
      Posted by Johannes L.
      on Jan 14 2009 12:13 PM
      Intellectual875 points

      tequila

      void ipark_sim_calc(IPARK_SIM *v)
      {   
            v->Alpha = v->Ds*Cos(v->Angle) - v->Qs*Sin(v->Angle);     /* line 13 in warning message*/
           v->Beta = v->Qs*Cos(v->Angle) + v->Ds*Sin(v->Angle); 
      }

       

      I thought it was clear from my first reply that the standard library Sine and Cosine functions are spelled sin() and cos() with a lower case first letter.

      Johannes

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • HTrudel
      Posted by HTrudel
      on Jan 14 2009 12:17 PM
      Prodigy200 points

      I dont know anything about what you're trying to compute it looks like a park function.  So you should take a look at how TI do it in SPRC178 (http://focus.ti.com/docs/toolsw/folders/print/sprc178.html).

      Install the code at the default location, then take a look at the code located in this folder:  C:\tidcs\DMC\c28\v32x\lib\dmclib\cfloat\src (if you installed at the default location).  The cfloat directory contains all the floating point versions of standard motor control functions and should compile and work fine with the F28335.

      Documentation is also included in the following directory C:\tidcs\DMC\c28\v32x\lib\doc.

      BTW, the error message you get means your ipark_sinus.obj file make a reference to a _Cos (or _Sin) function that is not linked to your project.  Either you need to add the source file which contains the cos and sinus function to your project or link to a library that contains them.  The functions sin and cos contained in rts2800_fpu32.lib are respectively called sin() and cos().  The c language is CaSe SeNsItIvE ;)

      Hope this helps...

      Regards,

      Hugo Trudel
      Software Eng. - Embedded Systems Specialist
      Rheinmetall Canada

      linker
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • tequila
      Posted by tequila
      on Jan 14 2009 12:51 PM
      Prodigy100 points

      oh noooooooo mannnnn:D::D:D:D

       

      jappp,  that was my stupid mistake[:'(]

      thank  u  very much :-)

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Shoaib Hussain
      Posted by Shoaib Hussain
      on Nov 18 2009 01:39 AM
      Prodigy170 points

      Hi,

      I've downloaded the function generator library nut don't really know how to use it with the code composer. I'm trying to generate a sine-triangle pwm but stuck with the coding. Are there any sample codes available for doing this? Can you suggest an algorithm that i can follow to get this  done?

      Here's what i'm trying to do:

      How can i implement this with my dsp (im using the ezdsp tms320f28335) ?

       

       

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Tim11828
      Posted by Tim11828
      on Mar 30 2010 19:30 PM
      Expert1300 points

      Hi all,

      I tried using the sine function with F28335, and the result is not what I'm expecting. I have included the rts2800_fpu32.lib, and math.h in the project, but still not working. Any suggestions?

      Thanks,

      Tim

      28335 sine
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Julian Pelaez Restrepo
      Posted by Julian Pelaez Restrepo
      on Feb 09 2011 10:34 AM
      Prodigy10 points

      I think use for this case, a sine function of "math.h" and HRPwm module, (Example Sine = 60hz, Pwm to 40khz fixed) when you have a request of interrup of pwm you can read a value of sine signal, and this value is the duty cycle of pwm signal.  Sorry by my english... i'm spanish...

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Yu Cai62050
      Posted by Yu Cai62050
      on Feb 09 2011 13:43 PM
      Intellectual810 points

      u can try to use the SGEN library in controlSUITE

      /TI/controlSUITE/libs/dsp/SGEN/v100/examples_ccsv4.

      there r a bunch of code for makeing sinusoidal wave.

      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