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.

[参考译文] TMS320F28P650SH:ADC 未读取中间值。

Guru**** 2815985 points

Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1600125/tms320f28p650sh-adc-not-reading-mid-values

器件型号: TMS320F28P650SH
主题: C2000WARE 中讨论的其他器件

事情是我们使用设计了库斯通评估板 TMS320F28P650SH6 176 引脚 控制器 IC ,硬件设计参数是正确的(我们使用了相同的设计在 f280039c 控制卡),问题是 ADC 针只是读数 为 0 或 3896 、说 2.5 针脚上存在电压(使用万用表验证)结果寄存器未读数

2.5V 以上有 4096 个、

 低于 2.5 伏

我使用的是 soc 触发代码示例、

偶数计时器触发代码提供相同的输出。 请我使用的任何帮助 SDK 5.04、  我正在使用准确的示例代码,

我试着改变 Vref 2.5 和 3.3 同样的事情也在发生,

还尝试了外部基准电压(也相应地更改了 Vref 设置)-发生了相同的情况。

 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Patel、

    您是否在代码中设置了外部电压基准?

    ADC_setVREF (ADC_A_BASE、ADC_REFERENCE_EXTERNAL、ADC_REFERENCE_2_5V);  
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Stevan  

    是的、我已经这样做并尝试使用  ADC_setVREF (ADC_A_BASE、ADC_REF_EXTERNAL、ADC_REF_3_3V);

    ADC_setVREF (ADC_A_BASE、ADC_REFERENCE_EXTERNAL、ADC_REFERENCE_2_5V) 以及

    adc_a_base (adc_reference_external, adc_reference_VREFHI ) 也尝试了这些仍然无法正常工作。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

      我的电路板原理图

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Stevan  

    是的、我已经这样做并尝试使用  ADC_setVREF (ADC_A_BASE、ADC_REF_EXTERNAL、ADC_REF_3_3V);

    ADC_setVREF (ADC_A_BASE、ADC_REFERENCE_EXTERNAL、ADC_REFERENCE_2_5V) 以及

    adc_a_base (adc_reference_external, adc_reference_VREFHI ) 也尝试了这些仍然无法正常工作。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    // this is one of example code soc pwm trigger example for all trigger modes the adc is not working properly- same problem persists please give assistance
    //###########################################################################
    //
    // FILE:   adc_ex1_soc_software.c
    //
    // TITLE:  ADC software triggering for f28p65x.
    //
    //! \addtogroup cpu01_example_list
    //! <h1> ADC SOC Software Force (adc_soc_software)</h1>
    //!
    //! This example converts some voltages on ADCA and ADCB  based on a software
    //! trigger.
    //!
    //! After the program runs, the memory will contain:
    //!
    //! - \b AdcaResult0 \b: a digital representation of the voltage on pin A2\n
    //! - \b AdcaResult1 \b: a digital representation of the voltage on pin A3\n
    //! - \b AdcbResult0 \b: a digital representation of the voltage on pin B2\n
    //! - \b AdcbResult1 \b: a digital representation of the voltage on pin B3\n
    //!
    //! Note: The software triggers for the two ADCs happen sequentially, so the
    //! two ADCs will run asynchronously.
    //!
    //
    //###########################################################################
    //
    //
    // 
    // C2000Ware v5.04.00.00
    //
    // Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
    //
    // Redistribution and use in source and binary forms, with or without 
    // modification, are permitted provided that the following conditions 
    // are met:
    // 
    //   Redistributions of source code must retain the above copyright 
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the 
    //   documentation and/or other materials provided with the   
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //###########################################################################
    
    //
    // Included Files
    //
    #include "f28x_project.h"
    
    //
    // Function Prototypes
    //
    void ConfigureADC(void);
    void SetupADCSoftware(void);
    
    //
    // Globals
    //
    Uint16 AdcaResult0;
    Uint16 AdcaResult1;
    Uint16 AdcbResult0;
    Uint16 AdcbResult1;
    
    void main(void)
    {
    //
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the f28p65x_sysctrl.c file.
    //
        InitSysCtrl();
    
    //
    // Step 2. Initialize GPIO:
    // This example function is found in the f28p65x_gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    //
        InitGpio();
    
    //
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    //
        DINT;
    
    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the f28p65x_piectrl.c file.
    //
        InitPieCtrl();
    
    //
    // Disable CPU interrupts and clear all CPU interrupt flags:
    //
        IER = 0x0000;
        IFR = 0x0000;
    
    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example.  This is useful for debug purposes.
    // The shell ISR routines are found in f28p65x_defaultisr.c.
    // This function is found in f28p65x_pievect.c.
    //
        InitPieVectTable();
    
    //
    // Enable global Interrupts and higher priority real-time debug events:
    //
        EINT;  // Enable Global interrupt INTM
        ERTM;  // Enable Global realtime interrupt DBGM
    
    //
    // Configure the ADCs and power them up
    //
        ConfigureADC();
    
    //
    // Setup the ADCs for software conversions
    //
        SetupADCSoftware();
    
    //
    // Take conversions indefinitely in loop
    //
        do
        {
            //
            // Convert, wait for completion, and store results
            // start conversions immediately via software, ADCA
            //
            AdcaRegs.ADCSOCFRC1.all = 0x0003; //SOC0 and SOC1
    
            //
            // Start conversions immediately via software, ADCB
            //
            AdcbRegs.ADCSOCFRC1.all = 0x0003; //SOC0 and SOC1
    
            //
            // Wait for ADCA to complete, then acknowledge flag
            //
            while(AdcaRegs.ADCINTFLG.bit.ADCINT1 == 0);
            AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    
            //
            // Wait for ADCB to complete, then acknowledge flag
            //
            while(AdcbRegs.ADCINTFLG.bit.ADCINT1 == 0);
            AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    
            //
            // Store results
            //
            AdcaResult0 = AdcaResultRegs.ADCRESULT0;
            AdcaResult1 = AdcaResultRegs.ADCRESULT1;
            AdcbResult0 = AdcbResultRegs.ADCRESULT0;
            AdcbResult1 = AdcbResultRegs.ADCRESULT1;
    
    
    
            //
            // At this point, conversion results are stored in
            // AdcaResult0, AdcaResult1, AdcbResult0, and AdcbResult1
            //
    
            //
            // Software breakpoint, hit run again to get updated conversions
            //
           // asm("   ESTOP0");
    
        }while(1);
    }
    
    //
    // ConfigureADC - Write ADC configurations and power up the ADC for both
    //                ADC A and ADC B
    //
    void ConfigureADC(void)
    {
        EALLOW;
    
        //
        // Write configurations
        //
       
    
        AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
        AdcbRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
    
        AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
        AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
    
        //
        // Set pulse positions to late
        //
        AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
        AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
    
        //
        // Power up the ADCs
        //
        AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
        AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
    
        //
        // Delay for 1ms to allow ADC time to power up
        //
        DELAY_US(1000);
    
        EDIS;
    }
    
    //
    // SetupADCSoftware - Setup ADC channels and acquisition window
    //
    void SetupADCSoftware(void)
    {
        Uint16 acqps;
    
        //
        // Determine minimum acquisition window (in SYSCLKS) based on resolution
        //
        if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
        {
            acqps = 79; //75ns
        }
        else //resolution is 16-bit
        {
            acqps = 63; //320ns
        }
    
        //
        // Select the channels to convert and end of conversion flag
        // ADCA
        //
        EALLOW;
        AdcaRegs.ADCSOC0CTL.bit.CHSEL = 2;  //SOC0 will convert pin A2
        AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps +
        AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 0;
                                               //1 SYSCLK cycles
        AdcaRegs.ADCSOC1CTL.bit.CHSEL = 3;  //SOC1 will convert pin A3
        AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps +
       AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 0;
                                               //1 SYSCLK cycles
        AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flag
        AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable INT1 flag
        AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared
        //ADCB
        AdcbRegs.ADCSOC0CTL.bit.CHSEL = 2;  //SOC0 will convert pin B2
        AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps +
                                               //1 SYSCLK cycles
        AdcbRegs.ADCSOC1CTL.bit.CHSEL = 3;  //SOC1 will convert pin B3
        AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps +
                                               //1 SYSCLK cycles
        AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flag
        AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable INT1 flag
        AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared
        EDIS;
    }
    
    //
    // End of file
    //
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    我将及时查看和答复。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Patel、

    您能否使用 driverlib 版本的代码而不是 bitfield 代码并再次进行检查?  C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28p65x\examples\c28x\adc

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Patel,

    对此查询有任何更新?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Stevan

    问题得到解决,这是一个硬件问题 vreflevo 是浮动的,

    感谢您的答复