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.

ezDSP Stick Floating Point Operations

Other Parts Discussed in Thread: TMS320VC5505

Dear TI,

I have been exercising the C5505 ezDSP Stick using the VC5505 FFT Filter Demo project with some sucess.

I want to add code which uses floating point math that I have used sucessfully in the USB_Stick_AudioFilter demo project provided by TI.

When viewing the floating point variables under debug, the numerical representation is very strange.

For example I have defined the variable charley as a floating point number using the statement : 

float 

 

charley;

 

 

 In the code I assign the value 10 to charley. When I run the code, charley is show to equal 1.92896E-33 immediately after the assingment

Both projects have the very same data_types.h include file.

Any help with correcting this behavoir will be greatly appreciatied.

Regards,

Charley

  • hi,

     

    Have you initialize charley?

    I tried and it was fine.

    float charley;

    charley = 10;  // if you see Local window, it showed as (x)= charley 10.0     Initial value was random 4.583228e+17

     

    Regards,

    Hyun

  • Hyun,

    good to hear from you.

    Yes, I have the exact same code as you list above. I declare float charley in main.c at the very top of the file and then in the main(void) section I use the statement  charley = 10;

    I do not know how to use local window. But I have set up a watch window and the results I get are shown in the attached screen shot.

     

    As you can see, the value assigned to charley after the assingment is not 10.0.

    If you want I can send or attach project file that I am working with.

    I suspect that there is a switch for  the C compiler which is not set properly for this project.

    Regards,

     

    Charley

  • Huyn,

    I think you will need the project file to see what is happening so I am forwarding it to you.

    Regards,

    Charley

    3000.VC5505 FFT Filter Demo.zip

  • Hi,

    unfortunately I couldn't build your project, some asm problems, probably it's just matter of switching between mnemonic ans algebraic assembly language but I don't have time for this. It doesn't matter, because I found one thing and there is quite good chance that's the hit. In project options optimization level is set to 2. Your charley variable is in fact unused, because at level 2 assignment itself is not threated as usage. So I think, that both - declaration and assignment doesn't exist in final build. Try to turn off optimization and tell us if it's working.

     

    regards

    MS

  • Michal,

    Thanks for your response.

    I tried your suggestion with no luck.

    I take your point about the additional fir.asm files causing compile problems.

    Since last night I have done the following.

    I completely removed Code Composer and all registry artifacts left over after removal and reinstalled Code Composer.

    I then found what I think is an origninal version of the VC5505_FFT_Demo project.

    I am able to get this compile and down load and run.

    However, I still see the same floating point number behavior that I reported earlier.

    I am attaching the complete folder for this project along with metafile data.

    I suspect that there is some difference between my CC installation and the one you are using. I am using the install software that came along with TMS320VC5505 eZdsp USB Stick hardware.

    I will appreciate your help in solving this riddle.

    Regards,

    Charley

    1185.TI_TEST.zip

  • Sorry, I've occurred same problem but can't find what is wrong with that project. Of course any other project with float variables works fine, so something must be wrong with that certain project properties. One last try - I can see that your project use huge memory model, while I'm using large model. Also in build options C5505 device should be specified instead "unknown C55x".

     

    regards

    MS 

  • Michal,

    Thanks for the note.

    Yes, I agree that there is something in the project properties that is causing the floating point problem.

    I did try using the device as "unknown C55x" and the build failed. I have found that a device specification of "cpu:3.3" works.

    And, I have tried using the large memory option rather than the huge. With this option I get the following error message:

    fatal error: file "C:/Program Files/Texas

    Instruments/ccsv4/tools/compiler/c5500/lib/rts55h.lib<exit.obj>" has a

    Tag_Memory_Model attribute value of "3" that is different than one

    previously seen ("2"); combining incompatible files.

     

    About finding an FFT Demo project that works, your colleague Huyn Kim that on his version of the project that he observed proper floating point operation.

    Will it be possible for you two guys to compare the two projects to see what is different?

    Thanks again,

    Regards,

    Charley

     

  • I'm not TI employee. Maybe they will find out what's going on. Anyway, changing device type and memory model didn't fix problem. However, I think that there may be something with linker file. I've replaced that file with one I use ("lynx.cmd", default for ezdsp) and value is correct now. Of course lynx.cmd can't be used with that project without modifications, but at least that's some trace.

     

    regards

    MS 

  • Michal,

    Sorry about my confusing you with TI.

    Did you replace the c5505.cmd file with the lynx.cmd file?

    Thanks for all the help!

    Regards,

    Charley

     

  • hi,

    I am also same problem !!!

        Int32 real = 3;
        Int32 img = 4;
        Float32 mag = sqrt( real^2 + img ^2);

    In the debug mode real = 3, img = 4 but mag = 2.645751 !!!!

    Guys .. do you have a fix for this..
    Please dont ask to change memory model to huge !! because : usbstk5515.gel file supports only large model.
    if we use huge : I get file incompatible error


  • The ^ operator is not exponentiation, it is XOR.  You need to write that like this:

    Float32 mag = sqrt(pow(real, 2) + pow(img, 2));

    or

    Float32 mag = sqrt(real * real + img * img);

    [ Edit: should be + instead of , -- Archaeologist ]

  • oops.. sry for that Matlab Influence !!!!!

    anyway thankx @ Archaeologist

    Int32 real = 244;
    Int32 img = 243;
    Float32 mag = sqrt(pow(real, 2), pow(img, 2));
    //Expected mag = 344.36

    But the answer coming is 344
    Is this the bug which ppl where point out .... I saw a few posts reporting problem with sqrt function
  • oops..

    I made a small mistake in the code.Answer is comming fine.

    I wonder wht was the bug which ppl had been reporting about sqrt_16() !!!!

    Cant they use this sqrt function ???

  • I have no idea what the bug is for sqrt_16.  sqrt_16 is not a standard C function, and it is not provided by the compiler.  Is there a ClearQuest number for that bug?

    Yes, sqrt is a standard C function, it is provided by the compiler's RTS library, and it should work fine, as long as you include math.h