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.

TMS320F28335 ADC初始化

Other Parts Discussed in Thread: TMS320F28335

    TMS320F28335芯片的ADC模块要求在初始化ADC的时候要有5ms 的延时,如果外部输入时钟晶振频率为25MHz,该如何配置各项参数来保证ADC模块正常启动?

  • 直接用Delay_us()函数就可以实现。

    具体参考Control Suite中提供的ADC初始化例程。

    InitAdc(void)
    {
    extern void DSP28x_usDelay(Uint32 Count);

    //
    // *IMPORTANT*
    // The ADC_cal function, which copies the ADC calibration values from
    // TI reserved OTP into the ADCREFSEL and ADCOFFTRIM registers, occurs
    // automatically in the Boot ROM. If the boot ROM code is bypassed during
    // the debug process, the following function MUST be called for the ADC to
    // function according to specification. The clocks to the ADC MUST be
    // enabled before calling this function. See the device data manual and/or
    // the ADC Reference Manual for more information.
    //
    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
    ADC_cal();
    EDIS;

    //
    // To powerup the ADC the ADCENCLK bit should be set first to enable
    // clocks, followed by powering up the bandgap, reference circuitry, and
    // ADC core. Before the first conversion is performed a 5ms delay must be
    // observed after power up to give all analog circuits time to power up
    // and settle
    //

    //
    // Please note that for the delay function below to operate correctly the
    // CPU_RATE define statement in the DSP2833x_Examples.h file must
    // contain the correct CPU clock period in nanoseconds.
    //
    AdcRegs.ADCTRL3.all = 0x00E0; // Power up bandgap/reference/ADC circuits
    DELAY_US(ADC_usDELAY); // Delay before converting ADC channels
    }

    自然此时应当有:

    #define ADC_usDELAY  5000L

  • 对,我知道Delay_us()函数,但是这应该只是针对30M外部晶振的情况。如果外部晶振是25M,则#define ADC_usDELAY  5000L就是不对的,满足不了5ms的延时。该如何修改?或者是#define ADC_usDELAY  5000L中的5000L该如何修正?谢谢~

  • 另外一个问题:TMS320F28335芯片ADC模块的初始化要求5ms延时这是最低要求还是唯一要求?就是说只要大于等于5ms就OK,还是只能是5ms?谢谢

  • 不好意思有注意25M的前提。

    可以注意一下DSP2833x_Example.h中关于DELAY_US()的定义。

    #define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / \
    (long double)CPU_RATE) - 9.0L) / 5.0L)

    当150MHz,程序中定义CPU_RATE=6.67L,也即6.67ns。

    您的具体设置我不清楚,当外部晶振是25MHz,相信这个CPU_RATE是多少相信您是能自己算出来的,改成您需要的数就行了

  • 这肯定是最低要求,确保ADC模块完成上电即可。

  • 那您说的“当150M”这个前提是在什么条件下满足的?30M和150M又是如何联系上的呢?这一个还没有涉及到您说的“您的具体设置我不清楚”吧?谢谢

  • 推荐您再仔细研究一下时钟这部分内容。 150M的CPU频率是由外部晶振(30M)经过PPL的倍频(10倍),再经过PPLSTS分频(1/2)得到的。

    Delay_us()函数里定义的CPU_RATE指的也是150Mhz的CPU频率。

    而这几个寄存器是跟您设置有关系的,这就是我说的您的具体设置。

    再具体的东西您得参考一下数据手册了:

    http://www.ti.com/lit/ug/sprufb0d/sprufb0d.pdf

  • 搞明白了,非常感谢!

  • 您好,麻烦能提供一下北京地区TI技术支持的联系方式吗?谢谢