Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

Generate Sine Wave with C6748 LCDK

$
0
0

Hi,

 

I'm using TMS320C6748 LCDK with xds100 v2 emulator to do some applications by using the book "Digital Signal Processing and Applications with the OMAP-L138 eXperimenter".

From the forum I know that "The textbook is compatible not only with the LogicPD OMAP-L138 eXperimenter but also with both the OMAP-L138 LCDK and the C6748 LCDK.". 

 

I try to generate sine wave by using the code in Chapter 1, which is as follows

 

// L138_sine48_buf_intr.c //

#include "L138_aic3106_init.h"

#define LOOPLENGTH 48

#define BUFLENGTH 256

int16_t sine_table[LOOPLENGTH] =   {0, 1305, 2588, 3827, 5000, 6088, 7071, 7934,    8660, 9239, 9659, 9914, 10000, 9914, 9659, 9239,    8660, 7934, 7071, 6088, 5000, 3827, 2588, 1305,    0, -1305, -2588, -3827, -5000, -6088, -7071, -7934,    -8660, -9239, -9659, -9914, -10000, -9914, -9659, -9239,    -8660, -7934, -7071, -6088, -5000, -3827, -2588, -1305};

int16_t sine_ptr = 0; // pointer into lookup table

int32_t buffer[BUFLENGTH];

int16_t buf_ptr = 0;

interrupt void interrupt4(void) // interrupt service routine {

  int16_t sample;

  sample = sine_table[sine_ptr];       // read sample from table

  output_left_sample(sample);          // output sample

  sine_ptr = (sine_ptr+1)%LOOPLENGTH;  // increment table index

  buffer[buf_ptr] = (int32_t)(sample); // store sample in buffer

  buf_ptr = (buf_ptr+1)%BUFLENGTH;     // increment buffer index  

  return;

}

int main(void) {  

 L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);

  while(1);

}

After I debugged the project, it says that

C674X_0: Output:  Target Connected.

C674X_0: Output:  Memory Map Cleared.

C674X_0: Output:  Memory Map Setup Complete.

C674X_0: Output:  PSC Enable Complete.

C674X_0: Output:  PLL0 init done for Core:300MHz, EMIFA:25MHz C674X_0: Output:  DDR initialization is in progress....

C674X_0: Output:  PLL1 init done for DDR:150MHz C

674X_0: Output:  Using DDR2 settings

C674X_0: Output:  DDR2 init for 150 MHz is done

C674X_0: Output:  DSP Wake Complete.

 

So I think that the configuration is correct.

When I run the c-code, the values in "sine_table"(16 bit signed integer) are correct, however, the values in the "buffer"(32 bit signed integer) which are for the output are wrong, i.e., the waveform is not sine.

In addition, I can't hear any sound from the output of the C6748 LCDK by earphoe.

Is it associated with the DIP switch or other settings, since I can generate and see the sine wave by C code only in simulation with CCS5, i.e., without using anything related to the C6748 LDCK?

Thanks.

 

Best regards,

PP


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>