This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320VC5509A: 采集正弦信号问题

Part Number: TMS320VC5509A


为什么DSP5509A采集得到的100Hz的正弦信号会存在其他频率。采样频率为8k,如下图:

像是经过调制之后的正弦信号,不知道为什么?

  • 请问是自己的板子还是EVM板?请先看一下是不是前端ADC的配置问题?

  • EVM板子,这个ADC应该怎么配置。

  • 请描述一下您的硬件测试环境,代码是自己写的还是用的例程里的?

  • PLL_Config myConfig = {
    0, //IAI: the PLL locks using the same process that was underway
    //before the idle mode was entered
    1, //IOB: If the PLL indicates a break in the phase lock,
    //it switches to its bypass mode and restarts the PLL phase-locking
    //sequence
    24, //PLL multiply value; multiply 24 times
    1 //Divide by 2 PLL divide value; it can be either PLL divide value
    //(when PLL is enabled), or Bypass-mode divide value
    //(PLL in bypass mode, if PLL multiply value is set to 1)
    };

    unsigned int play_mode; // 0:play 1:record and play

    MCBSP_Config Mcbsptest;

    /*McBSP set,we use mcbsp1 to send and recieve the data between DSP and AIC23*/
    MCBSP_Config Mcbsp1Config = {
    MCBSP_SPCR1_RMK(
    MCBSP_SPCR1_DLB_OFF, /* DLB = 0,禁止自闭环方式 */
    MCBSP_SPCR1_RJUST_LZF, /* RJUST = 2 */
    MCBSP_SPCR1_CLKSTP_DISABLE, /* CLKSTP = 0 */
    MCBSP_SPCR1_DXENA_ON, /* DXENA = 1 */
    0, /* ABIS = 0 */
    MCBSP_SPCR1_RINTM_RRDY, /* RINTM = 0 */
    0, /* RSYNCER = 0 */
    MCBSP_SPCR1_RRST_DISABLE /* RRST = 0 */
    ),
    MCBSP_SPCR2_RMK(
    MCBSP_SPCR2_FREE_NO, /* FREE = 0 */
    MCBSP_SPCR2_SOFT_NO, /* SOFT = 0 */
    MCBSP_SPCR2_FRST_FSG, /* FRST = 0 */
    MCBSP_SPCR2_GRST_CLKG, /* GRST = 0 */
    MCBSP_SPCR2_XINTM_XRDY, /* XINTM = 0 */
    0, /* XSYNCER = N/A */
    MCBSP_SPCR2_XRST_DISABLE /* XRST = 0 */
    ),
    /*单数据相,接受数据长度为16位,每相2个数据*/
    MCBSP_RCR1_RMK(
    MCBSP_RCR1_RFRLEN1_OF(1), /* RFRLEN1 = 1 */
    MCBSP_RCR1_RWDLEN1_16BIT /* RWDLEN1 = 2 */
    ),
    MCBSP_RCR2_RMK(
    MCBSP_RCR2_RPHASE_SINGLE, /* RPHASE = 0 */
    MCBSP_RCR2_RFRLEN2_OF(0), /* RFRLEN2 = 0 */
    MCBSP_RCR2_RWDLEN2_8BIT, /* RWDLEN2 = 0 */
    MCBSP_RCR2_RCOMPAND_MSB, /* RCOMPAND = 0 */
    MCBSP_RCR2_RFIG_YES, /* RFIG = 0 */
    MCBSP_RCR2_RDATDLY_1BIT /* RDATDLY = 1 */
    ),
    MCBSP_XCR1_RMK(
    MCBSP_XCR1_XFRLEN1_OF(1), /* XFRLEN1 = 1 */
    MCBSP_XCR1_XWDLEN1_16BIT /* XWDLEN1 = 2 */

    ),
    MCBSP_XCR2_RMK(
    MCBSP_XCR2_XPHASE_SINGLE, /* XPHASE = 0 */
    MCBSP_XCR2_XFRLEN2_OF(0), /* XFRLEN2 = 0 */
    MCBSP_XCR2_XWDLEN2_8BIT, /* XWDLEN2 = 0 */
    MCBSP_XCR2_XCOMPAND_MSB, /* XCOMPAND = 0 */
    MCBSP_XCR2_XFIG_YES, /* XFIG = 0 */
    MCBSP_XCR2_XDATDLY_1BIT /* XDATDLY = 1 */
    ),
    MCBSP_SRGR1_DEFAULT,
    MCBSP_SRGR2_DEFAULT,
    MCBSP_MCR1_DEFAULT,
    MCBSP_MCR2_DEFAULT,
    MCBSP_PCR_RMK(
    MCBSP_PCR_IDLEEN_RESET, /* IDLEEN = 0 */
    MCBSP_PCR_XIOEN_SP, /* XIOEN = 0 */
    MCBSP_PCR_RIOEN_SP, /* RIOEN = 0 */
    MCBSP_PCR_FSXM_EXTERNAL, /* FSXM = 0 */
    MCBSP_PCR_FSRM_EXTERNAL, /* FSRM = 0 */
    0, /* DXSTAT = N/A */
    MCBSP_PCR_CLKXM_INPUT, /* CLKXM = 0 */
    MCBSP_PCR_CLKRM_INPUT, /* CLKRM = 0 */
    MCBSP_PCR_SCLKME_NO, /* SCLKME = 0 */
    MCBSP_PCR_FSXP_ACTIVEHIGH, /* FSXP = 0 */
    MCBSP_PCR_FSRP_ACTIVEHIGH, /* FSRP = 1 */
    MCBSP_PCR_CLKXP_FALLING, /* CLKXP = 1 */
    MCBSP_PCR_CLKRP_RISING /* CLKRP = 1 */
    ),
    MCBSP_RCERA_DEFAULT,
    MCBSP_RCERB_DEFAULT,
    MCBSP_RCERC_DEFAULT,
    MCBSP_RCERD_DEFAULT,
    MCBSP_RCERE_DEFAULT,
    MCBSP_RCERF_DEFAULT,
    MCBSP_RCERG_DEFAULT,
    MCBSP_RCERH_DEFAULT,
    MCBSP_XCERA_DEFAULT,
    MCBSP_XCERB_DEFAULT,
    MCBSP_XCERC_DEFAULT,
    MCBSP_XCERD_DEFAULT,
    MCBSP_XCERE_DEFAULT,
    MCBSP_XCERF_DEFAULT,
    MCBSP_XCERG_DEFAULT,
    MCBSP_XCERH_DEFAULT
    };
    /* This next struct shows how to use the I2C API */
    /* Create and initialize an I2C initialization structure */
    I2C_Setup I2Cinit = {
    0, /* 7 bit address mode */
    0, /* own address - don't care if master */
    84, /* clkout value (Mhz) */
    50, /* a number between 10 and 400*/
    0, /* number of bits/byte to be received or transmitted (8)*/
    0, /* DLB mode on*/
    1 /* FREE mode of operation on*/
    };

    I2C_Config testI2C;

    AIC23为主模式,数据为DSP模式,数据长度16位*/
    Uint16 digital_audio_inteface_format[2]={0x0e,0x53};
    /*AIC23的波特率设置,采样率为44.1K*/
    Uint16 sample_rate_control[2] = {0x10,0x2e};
    /*AIC23寄存器复位*/
    Uint16 reset[2] ={0x1e,0x00};
    /*AIC23节电方式设置,所有部分均所与工作状态*/
    Uint16 power_down_control[2] ={0x0c,0x00};
    /*AIC23模拟音频的控制
    DAC使能,ADC输入选择为Line,mic输入,增益为0*/
    Uint16 analog_aduio_path_control[2] ={0x08,0x14};
    /*AIC23数字音频通路的控制*/
    Uint16 digital_audio_path_control[2] ={0x0a,0x05};
    /*AIC23数字接口的使能*/
    Uint16 digital_interface_activation[2] ={0x12,0x01};
    /*AIC23左通路音频调节*/
    Uint16 left_line_input_volume_control[2] ={0x00,0x17};
    /*AIC23右通路音频调节*/
    Uint16 right_line_input_volume_control[2] ={0x02,0x17};
    /*AIC23耳机左通路音频调节*/
    Uint16 left_headphone_volume_control[2] ={0x05,0xFF};
    /*AIC23耳机右通路音频调节*/
    Uint16 right_headphone_volume_control[2] = {0x07,0xFF};
    /*定义McBSP的句柄*/

  • 代码调用dsplib内的sin函数

  • 您可以参考附件DSK5509A开发板里的tone例程。
    dsk5509a_v1.zip

  • 我现在这个是mic in ,如何改为line in 输入呢

  • 我看了 一下代码,这个是配置AIC23的
    /* Codec configuration settings */
    DSK5509_AIC23_Config config = {
    0x0017, // 0 DSK5509_AIC23_LEFTINVOL Left line input channel volume
    0x0017, // 1 DSK5509_AIC23_RIGHTINVOL Right line input channel volume
    0x00d8, // 2 DSK5509_AIC23_LEFTHPVOL Left channel headphone volume
    0x00d8, // 3 DSK5509_AIC23_RIGHTHPVOL Right channel headphone volume
    0x0011, // 4 DSK5509_AIC23_ANAPATH Analog audio path control
    0x0000, // 5 DSK5509_AIC23_DIGPATH Digital audio path control
    0x0000, // 6 DSK5509_AIC23_POWERDOWN Power down control
    0x0043, // 7 DSK5509_AIC23_DIGIF Digital audio interface format
    0x0081, // 8 DSK5509_AIC23_SAMPLERATE Sample rate control
    0x0001 // 9 DSK5509_AIC23_DIGACT Digital interface activation
    };

    具体怎么设置AIC23寄存器参数,建议去音频论坛咨询。
    https://e2echina.ti.com/support/audio/f/audio-forum