Multiplying DAC-Values with Factor

Hi,

I´m using the ADSP-SC584 with the respective Evaluation-Board and Cross Core 2.8.3.

I use the ADC-DAC-Playack Example for SHARC ADSP-SC589.

I configured this Project that the ADC reads a Signal from a Function-Generator into the ADC-Buffer. Then I copy the ADC-Buffer to DAC-Buffer and measure the output with an Osciloscope.

This works fine but when I try to scale the values with a factor (for example multiplying with 2) the Signal become 4 times higher rather than the expected 2 times.

for scaling the DAC-Values I do the following:

uint32_t* pointer4bytes;

_______________________________________________________________

pointer4bytes = (uint32_t*) &DacBuf[0];    // DacBuf is a uint8_t Array

for(i=0; i<(   AUDIO_BUFFER_SIZE  / (  NUM_CHANNELS  *  SAMPLE_SIZE ) ) ; i++)     // NUM_CHANNELS = 4 && SAMPLE_SIZE = 4       

{                                                                                                                                          // AUDIO_BUFFER_SIZE = X * SAMPLE_PER_PERIOD * NUM_CHANNELS * SAMPLE_SIZE

           *(pointer4bytes + i * NUM_CHANNELS) *= 2;      // I scale the values

}

_______________________________________________________________

this is the same technique like in the function Generate_Sinus_Wave.

I dont know where my mistake is.

PS. I heared about saturation arithmetic and not sure how to aquire this. I have read that I have to set the SATURATIONBIT of the ALU but I´m not sure how to do this

Parents
  • +1
    •  Analog Employees 
    on Jun 17, 2019 6:09 AM

    Hi,

    We implemented and debugged your setup as similar in ADSP-SC584 EZkit.Input of 1khz sine wave is given to ADC(J3) and it is verified by scoping.Input frequency is 1Khz and it's peak-peak amplitude is measured as nearly 5v.

    Now playback code is executed without any scaling factor and waveform is measured in DAC side(J11).
    *pDst++ = *pSrc++;//code without scaling factor.
    Measured frequency is 1khz and amplitude is nearly 2V.

    Now we scaled the signal by scaling factor as 2.
    *pDst++ = (*pSrc++)*2;//code with scaling factor 2.

    Measured frequency is same (1khz) and amplitude is multiplied by 2.(peak-peak as 4V) as expected. Note that we compared scoped images with scaling factor as 2 and without scaling factor, not with input given to ADC.
    Likewise we verified waveforms with different scaling factor. Please refer the attachments.

    Could you please send us the scoped images to proceed further for
    1. Input given to ADC?
    2. Output from DAC without scaling factor?
    3. Output from DAC with scaling factor as 2?

    We hope that, there is no process between copying source ADC Buffer and Destination DAC buffer. In case if you have any process like IIR Filtering, saturation logic and integration logic,please verify the process in logic level. Because that will definitely cause some integrated values to output.

    Regards,
    Divya.P3666.Screenshots.zip

Reply
  • +1
    •  Analog Employees 
    on Jun 17, 2019 6:09 AM

    Hi,

    We implemented and debugged your setup as similar in ADSP-SC584 EZkit.Input of 1khz sine wave is given to ADC(J3) and it is verified by scoping.Input frequency is 1Khz and it's peak-peak amplitude is measured as nearly 5v.

    Now playback code is executed without any scaling factor and waveform is measured in DAC side(J11).
    *pDst++ = *pSrc++;//code without scaling factor.
    Measured frequency is 1khz and amplitude is nearly 2V.

    Now we scaled the signal by scaling factor as 2.
    *pDst++ = (*pSrc++)*2;//code with scaling factor 2.

    Measured frequency is same (1khz) and amplitude is multiplied by 2.(peak-peak as 4V) as expected. Note that we compared scoped images with scaling factor as 2 and without scaling factor, not with input given to ADC.
    Likewise we verified waveforms with different scaling factor. Please refer the attachments.

    Could you please send us the scoped images to proceed further for
    1. Input given to ADC?
    2. Output from DAC without scaling factor?
    3. Output from DAC with scaling factor as 2?

    We hope that, there is no process between copying source ADC Buffer and Destination DAC buffer. In case if you have any process like IIR Filtering, saturation logic and integration logic,please verify the process in logic level. Because that will definitely cause some integrated values to output.

    Regards,
    Divya.P3666.Screenshots.zip

Children