Other Parts Discussed in Thread: CC1352P7,
Dear Sir,
We are trying to use the TAS2560 with the CC1352p7 using I2S. We finally got some sound by generating a tone using the below function :-
// Generates a sine wave at the specified frequency and sampling rate..
void generateSineWave(int16_t *buffer, int bufferLength, double frequency, double samplingRate)
{
for (int i = 0; i < bufferLength; i++)
{
double t = (double)i / samplingRate;
double value = sin(2.0 * M_PI * frequency * t);
buffer[i] = (int16_t)(value * 32767.0); // Convert to 16-bit PCM range (-32768 to 32767)
}
}
What we realize is no matter what we set the freq to, the tone is always the same. It seems like a muffled medium pitched loud sound. We are not sure what we are doing wrong. Furthermore what register can we use from i2c to control the volume?
Furthermore can you advise what kind of file is needed to play sound, how can i convert a mp3 file for i2s?
i2sParams.samplingFrequency = 48khz;
These are our config regs:-
cfg_reg registers[] = {
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x07, 0x41 },
{ CFG_META_DELAY, 0x10 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x07, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x01, 0x01 },
{ CFG_META_DELAY, 0x10 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
// Specify the clock (MCLK/BCLK)
{ 0x0f, 0x01 },
// PLL P
{ 0x0f, 0x01 },
// PLL J
{ 0x10, 0x20 },
// PLL D - MSB 6 bits
{ 0x11, 0x00 },
// PLL D - LSB 8 bits
{ 0x12, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x00 },
//decimation and interpolation
{ 0x0d, 0x08 },
{ 0x0e, 0x10 },
//clock error detection
{ 0x50, 0x31 },
{ 0x04, 0x5f },
{ 0x15, 0x02 },
{ 0x09, 0x83 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0xfd },
{ 0x36, 0xc0 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x08, 0x01 },
{ 0x36, 0x32 },
{ 0x22, 0x3f },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x49, 0x0c },
{ 0x3c, 0x33 },
{ 0x02, 0x02 },
{ 0x07, 0x41 },
{ CFG_META_DELAY, 0x10 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x28, 0x7f },
{ 0xfb, 0xb5 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x2c, 0x80 },
{ 0x04, 0x4c },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x30, 0x7f },
{ 0xf7, 0x6a },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x1c, 0x7f },
{ 0xff, 0xff },
{ 0xff, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x20, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x24, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x33 },
{ CFG_META_BURST, 4 },
{ 0x18, 0x06 },
{ 0x66, 0x66 },
{ 0x66, 0x00 },
{ 0x00, 0x34 },
{ CFG_META_BURST, 4 },
{ 0x34, 0x3a },
{ 0x46, 0x74 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x38, 0x22 },
{ 0xf3, 0x07 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x3c, 0x80 },
{ 0x77, 0x61 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x40, 0x22 },
{ 0xa7, 0xcc },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x44, 0x3a },
{ 0x0c, 0x93 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x33 },
{ CFG_META_BURST, 4 },
{ 0x10, 0x75 },
{ 0xc2, 0x8e },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x14, 0x6e },
{ 0x14, 0x79 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x20, 0x1e },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x24, 0x21 },
{ 0x3d, 0x71 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x28, 0x24 },
{ 0x7a, 0xe1 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x2c, 0x27 },
{ 0xb8, 0x52 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x30, 0x2a },
{ 0xf5, 0xc3 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x34, 0x2e },
{ 0x33, 0x33 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x38, 0x31 },
{ 0x70, 0xa4 },
{ 0x00, 0x00 },
{ CFG_META_BURST, 4 },
{ 0x3c, 0x34 },
{ 0xae, 0x14 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x3c, 0x3d },
{ 0x99, 0x9a },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x40, 0x30 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x44, 0x50 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x4c, 0x02 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x54, 0x00 },
{ 0x88, 0x40 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x58, 0x00 },
{ 0x06, 0xd3 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x32 },
{ CFG_META_BURST, 4 },
{ 0x60, 0x28 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x33 },
{ CFG_META_BURST, 4 },
{ 0x40, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x00, 0x33 },
{ CFG_META_BURST, 4 },
{ 0x64, 0x39 },
{ 0x80, 0x00 },
{ 0x00, 0x00 },
{ 0x00, 0x00 },
{ 0x7f, 0x00 },
{ 0x07, 0x40 },
};