• 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 » Digital Signal Processors (DSP) » C6000 Single Core DSP » C64x Single Core DSP Forum » Simple inout program with 32b*32b multiplication
Share
C6000 Single Core DSP
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Simple inout program with 32b*32b multiplication

Simple inout program with 32b*32b multiplication

This question is answered
Samuel R��unif
Posted by Samuel R��unif
on Mar 16 2012 08:01 AM
Prodigy60 points

Good morning folks!

I'm having trouble running a very simple program. As from today, we are able to run a simple inout program that takes samples from the aic23 codec and writes them back to output. For example if we put a sinewave as an input we get the sample wave as an output. We can make additions between samples and get the resulting output right. BUT as soon as we try to multiply 2 samples (like in code below) the output is saturated. The following code (very simple) works EXCEPT the line in red wich is problematic. We thought this could be a format problem : what is the result of a Uint32bits*Uint32bits (assuming the ouuput of the write32 function is a 32bit value) operation? Does it result in a Uint32bits value? Second idea was that we do not use a correct target configuration ( but we can make a inout program work ...) .

Im sure this problem must seem ridiculous but im really stuck and i cant write any Signal processing program if I can't understand how to make a multiplication!!!!!

 Regards

SR

 

My code (works except the RED line wich is problematic)

 

 

 

 

 


#include "dsk6455.h"
#include "dsk6455_aic23.h"




/* Codec configuration settings */
DSK6455_AIC23_Config config = {
    0x0117, // 0 DSK6455_AIC23_LEFTINVOL  Left line input channel volume
    0x0017, // 1 DSK6455_AIC23_RIGHTINVOL Right line input channel volume
    0x00d8, // 2 DSK6455_AIC23_LEFTHPVOL  Left channel headphone volume
    0x00d8, // 3 DSK6455_AIC23_RIGHTHPVOL Right channel headphone volume
    0x0011, // 4 DSK6455_AIC23_ANAPATH    Analog audio path control
    0x0000, // 5 DSK6455_AIC23_DIGPATH    Digital audio path control
    0x0000, // 6 DSK6455_AIC23_POWERDOWN  Power down control
    0x0043, // 7 DSK6455_AIC23_DIGIF      Digital audio interface format
    0x0001 // 9 DSK6455_AIC23_DIGACT     Digital interface activation
};

void main()
{
    DSK6455_AIC23_CodecHandle hCodec;
    Uint32 leftsample,rightsample;
  
    // initializes the board
    DSK6455_init();
    DSK6455_DIP_init();

       
        /* Start the codec */
            hCodec = DSK6455_AIC23_openCodec(0, &config);
        
  
            /* read a sample to the left channel */
            while (!DSK6455_AIC23_read32(hCodec, &leftsample));
         


            leftsample = leftsample*leftsample;

            /* Send a sample to the right channel */
            while (!DSK6455_AIC23_write32(hCodec, leftsample));
           

           


           
    }

        /* Close the codec */
                DSK6455_AIC23_closeCodec(hCodec);

   
}

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • RandyP
    Posted by RandyP
    on Mar 16 2012 13:42 PM
    Guru59970 points

    Samuel,

    You do not have balanced { } in your main() function. Program code is obviously missing.

    What do you expect the result to be of the line highlighted in red?

    When you set a breakpoint at the line in red and single step over it, how do the results compare with what you expect?

    Regards,
    RandyP

    Search for answers, Ask a question, click  Verify  when complete, Help others, Learn more.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Samuel R��unif
    Posted by Samuel R��unif
    on Mar 17 2012 05:16 AM
    Prodigy60 points

    Randy,


    I must have made a copy mistake when i wrote the post sorry. The tested code  does not have any compilation problem. I expected simply to get the square signal.
    I wanted to implement audio effects (fir echo filter, equalizing, flanger ...) but never had any clean output so I first tried to make simple operations like getting the square of the signal. When I watch the value of leftsample and when i do leftsample2 = leftsample*leftsample ( to see if the values match)  i do get the squared value of leftsample in leftsample2. Putting a sinewave as an input, the output should (?) be the restated sinewave. Instead I get a "dirty" output that I can't explain.

     

    Regards,

    Sam

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • RandyP
    Posted by RandyP
    on Mar 17 2012 08:02 AM
    Guru59970 points

    Sam,

    When you read 32 bits, what are the range and position of the data bits in the 32-bit word leftsample?

    When you square leftsample, what are the range and position of the data bits in the new 32-bit word in leftsample?

    When you write 32 bits, what are the required range and position of the data bits in the 32-bit word written to the AIC23?

    Regards,
    RandyP

    Search for answers, Ask a question, click  Verify  when complete, Help others, Learn more.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Samuel R��unif
    Posted by Samuel R��unif
    on Mar 21 2012 15:25 PM
    Verified Answer
    Verified by RandyP
    Prodigy60 points

    Randy,

    Sorry i had no access to internet these last days, couldn't answer earlier. I found the solution to my problem, the aic23_read function reads 32bits words: lower 16bits for leftsample and other 16 bits for rightsample.I found an easy way to extract the two 16bit words.

    I would have other questions, but i guess i should create a new post.

    Thank you for your help!!!

    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