Other Parts Discussed in Thread: OMAP-L138,
Tool/software: Code Composer Studio
I have been using a couple of books to attempt to make a sine wave generator for a couple of channels on my TMS3260C6748 LCDK. However, every time I try to output 1 kHz frequency, I get roughly 243Hz from the scope and from using an FFT from my cell phone. I've attempted both ways using a difference equation and a sine table for generating the symbol. I'm starting to believe it has something to do with the clock generation of my LCDK but I've tried multiple changes in sampling frequency which didn't change anything as I would have expected. I've also tried increasing the clock frequency of my LCDK to see if there would be a change but I didn't see anything. Here is some example code I use to generate my sine wave. This code was taken from "Digital Signal Processing and applications with the OMAP-L138 Experimenter." They supply files to work with the LCDK as well and those are the ones I am using for this example.
// L138_sine48_buf_intr.c
//
#include "L138_LCDK_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,LCDK_LINE_INPUT);
while(1);
}
Has anyone experienced a similar problem like this?