Hi, I am using TLV320DAC3120 and trying to use the beep generator (PRB_P25) to generate pure sinewaves for chosen frequencies (parameter FHz), I have other modes where I send I2S from PIC32 (It works great with Fs=48Khz configured on the board using internal PLL) but on this mode I would like to generate sinewaves using the audio board and repeat to make it continuously playing until one of the parameters change.
I followed instructions on Datasheet for my calculations and config, I also checked values sent to registers and compared them to fixed examples and it seems correct :
uint8_t MATCH_Config[10][2]; //{Register address, Register value} appData.MATCH.sine = floor(sin((2 * M_PI * FHz) / (48000))*(pow(2, 15))); appData.MATCH.cosine = floor(cos(2 * M_PI * FHz / (48000))*(pow(2, 15))); appData.MATCH.beepLength = floor((48000) * 1000 / FHz); //1000 cycles MATCH_Config[0][0] = 0x00; //Select page 0 MATCH_Config[0][1] = 0x00; MATCH_Config[1][0] = 0x49; MATCH_Config[1][1] = (int) ((appData.MATCH.beepLength) & 0xff); //Reg 73 MATCH_Config[2][0] = 0x4A; MATCH_Config[2][1] = (int) (((appData.MATCH.beepLength) >> 8) & 0xff); //Reg 74 MATCH_Config[3][0] = 0x4B; MATCH_Config[3][1] = (int) (((appData.MATCH.beepLength) >> 16) & 0xff); //Reg 75 MATCH_Config[4][0] = 0x4C; MATCH_Config[4][1] = (int) (((appData.MATCH.sine) >> 8)); //Reg 76 - SINE MSB MATCH_Config[5][0] = 0x4D; MATCH_Config[5][1] = (int) (((appData.MATCH.sine)) & 0xff); //Reg 77 - SINE LSB MATCH_Config[6][0] = 0x4E; MATCH_Config[6][1] = (int) (((appData.MATCH.cosine) >> 8)); //Reg 78 - COSINE MSB MATCH_Config[7][0] = 0x4F; MATCH_Config[7][1] = (int) (((appData.MATCH.cosine)) & 0xff); //Reg 79 - COSINE LSB //volume as described in Datasheet to make correspondance with binary value table (page 68 REG 65) MATCH_Config[8][0] = 0x41; MATCH_Config[8][1] = 0x00; //appData.MATCH.volume; Page 0 Reg 65 MATCH_Config[9][0] = 0x47; MATCH_Config[9][1] = 0x80; //Page 0 Reg 71 0x80 (max volume for beepr) /* Sending via I2C */ I2C_Transmit((sizeof (MATCH_Config) / 2), MATCH_Config);
When I probe the result (with FHz=200Hz for example) I get a square wave of 320Hz and not a sinewave:
Any ideas on why I get this false result? using PurePath Studio I output using "ToneGenerator" block and probe and I get perfect sinewaves.
Best Regards,
EE student.