Simple inout program with 32b*32b multiplication

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!!!!!




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

        /* 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 */


  • 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?


  • In reply to RandyP:


    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.




  • In reply to samuel.reunif:


    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?


  • In reply to RandyP:


    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!!!