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.

ADC setup difficulties

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Hello. I am trying to setup the ADC of a TMS320F28335 Experimenter's kit. I believe I setup the registers correctly but I think the hardware setup is wrong because I am not getting any digital value despite the analog voltage input. I am only using one pin (A0) for one conversion which is hooked up to a power supply; I have the power supply and the kit grounded but I feel there is something missing. The uC manual mentioned something about ADC Reference High and low pins but there are no such pins on the kit. Can any of you help me out? For your convenience I posted the bit settings of the ADC below. Thank You.

//Control Register

AdcRegs.ADCTRL3.bit.ADCBGRFDN = 3;                            //The Bandgap and reference circuitry is powered up

AdcRegs.ADCTRL3.bit.ADCPDN = 1;                     //Analog circuitry inside the core is powered up

AdcRegs.ADCTRL3.bit.ADCCLKPS = 0;               // Core Clock Divider: HSPCLK/(ADCTRL1[7] +1)

AdcRegs.ADCTRL3.bit.SMODE_SEL = 0;            // Sequential sampling mode is selected

//A cycle delay gets posted here

EALLOW;

SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;

ADC_cal();

EDIS;

//Control Register 1

AdcRegs.ADCTRL1.bit.ACQ_PS = 0x0;              //No Acquisition window

AdcRegs.ADCTRL1.bit.CONT_RUN = 1;           // Continuous mode

AdcRegs.ADCTRL1.bit.CPS = 0;                        // Core clock prescaler disabled

AdcRegs.ADCTRL1.bit.SEQ_CASC = 0;         //Dual-sequencer mode

AdcRegs.ADCTRL1.bit.SEQ_OVRD = 0;       //Sequence over rider disabled

AdcRegs.ADCTRL1.bit.SUSMOD = 0x01;      //Mode 1: Sequencer and other wrapper logic stops after current sequence is completed

//Control Register 2

AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 0;             // ePWM will not trigger start of conversion (SOC)

AdcRegs.ADCTRL2.bit.EPWM_SOCB_SEQ = 0;              // ePWM will not trigger SOC

AdcRegs.ADCTRL2.bit.EPWM_SOCB_SEQ2 = 0;          // ePWM will not trigger SOC

AdcRegs.ADCTRL2.bit.EXT_SOC_SEQ1 = 0;              //External interrupt will not trigger SOC

AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;               //Interrupt enabled for SEQ1

AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1 = 0;              // Interrupt is set at the end of every SEQ1 sequence

AdcRegs.ADCTRL2.bit.INT_ENA_SEQ2 = 0;             // No interrupt for SEQ2

AdcRegs.ADCTRL2.bit.INT_MOD_SEQ2 = 0;            // Don't care sincce interrupt is disabled

// Maximum Conversion Channels Register

AdcRegs.ADCMAXCONV.bit.all = 0x0           // 1 conversion for SEQ1

// Input Channel Select Sequencing Control Registers

AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;         //Setup ADCINA0 pin to SEQ1

AdcRegs.ADCREFSEL.bit. REF_SEL = 0;       // 00 - Internal Reference selected (default)

                                                                                // 01 - External Reference, 2.048 V on ADCREFIN

                                                                               // 10 - External Reference, 1.500 V on ADCREFIN

                                                                             // 11 - External Reference, 1.024 V on ADCREFIN

  • Daryl,

    If you haven't already, it may be worthwhile to try out some of the ADC example projects found in controlSUITE at:
    C:\TI\controlSUITE\device_support\f2833x\v133\DSP2833x_examples_ccsv4\

    ADC REFHI and REFLO exist on the chip directly.  The controlCARD attaches these as per the datasheet.  Note that the schematics for the controlCARD are at:
    C:\TI\controlSUITE\development_kits\~controlCARDs\

    This will at least allow you to experiment with the ADC and evaluate it.


    Thank you,
    Brett

  • What is your high-speed clock set to ( SysCtrlRegs.HISPCP )?  Your ADCCLK prescaler (CPS) is set to 0 which means the ADCCLK is equal to the HSPCLK which can exceed the maximum clock rate of the ADC (25MHz).

  • Joe,

     The HSPCLK is set to 25 MHz (SysCtrlRegs.HISPCP.all = 0x03) and the ADCCLK prescaler is set to 0 (AdcRegs.ADCTRL1.bit.CPS = 0) so the ADCCLK is equal to the HSPCLK. The ADCCLK is running at it's maximum clock rate of 25 MHz.

  • Brett,

     I have been using the ADC example projects and they have helped up to this point; they never mentioned anything about reference pins. I check the hardware schematics  when you mentioned the data sheets, the development kit in question is a USB Docking Station (Revision 3) for C2000 platform microcontrollers. I went through it several times and I couldn't find anything regarding ADC voltage reference pins. If you want I can send you the hardware schematics via email, I can probably use another set of eyes to look at this anyway. I want to assume that these pins are already grounded and that switching the ADC reference to internal is the proper solution when dealing with this development kit. Do you agree? Your insight will be most helpful.  

  • Daryl,

    I am guessing that your system currently consists of two PCBs.  One is a USB Docking Station and the other is a F28335 controlCARD which plugs into it.  The Docking Station's schematics are pretty barebones, but the controlCARD's schematics will provide the information on how the device is powered, clocked, etc. Note that all pins of the F28335 do not go through to the Docking Station. If you wanted to experiment with the controlCARD directly you could solder on some flying leads, remove a few components, etc.

    I'll reference you to the schematics for the controlCARD which are at:
    C:\TI\controlSUITE\development_kits\~controlCARDs\CC2833xHWdevPkg\


    Thank you,
    Brett

  • Daryl- as Brett indicated the ControlCARD should have the necessary HW connections to REFP, REFM, RESEXT, and ADCLO to use the ADC in internal reference mode.

    Going back to the original post, you indicate the you are "not getting any digital value".  Can you  please clarify what is meant?  Are you not seeing the result register updating and therefore perhaps the SOC is never getting triggered, or you are seeing conversion results, they are just unexpected?

  • Joe,

     I get a zero value no matter what the voltage input of the ADC is. Here is a pseudo code example of what I am trying to do:

      INT16 Result = 0;

       while( ADC_SEQ1_BUSY != 0) { /* Wait until sequence 1 is not busy */}

        Result = ADC_Digital_Result; 

  • Daryl- does the ADC_SOC example work without modification?

  • Hey guys,

    I got an update on the ADC. I decided to go from doing one conversion on one pin to doing 16 conversions on one pin; I did it by cascading both of the sequencers and channeling all conversions to one pin (A0). As a result I'm able to go from a digital value of 0 to a value of 2592, but the ADC sticks with that value no matter what voltage I applied to the A0 pin. My first reaction to this problem was that the ADCCLK needed to be reconfigured, so I set the acquisition window (ACQ_PS) to 0 and played with the core clock divider (ADCCLKPS) and the core clock prescaler (CPS). Unfortunately my tinkering had no effect, do you guys have any ideas? My High-Speed Peripheral Clock is at 25 MHz, just to let you guys know.

  • Hey guys this is how I setup the ADC on my evaluation kit. The A0 pin is connected to the '+' pin of a DC power supply and the ground pin is connected to the '-' pin of that same DC power supply. The more you know, the more we can find the answer.

  • I would recommend using the provided ADC conversion example unchanged to debug the hardware connections.  Once you see the expected voltage change using the provided example, then move on to modified sampling.

  • Devin,

     I was able to figure out the problem a while back. I took your advice and used the ADC conversion example and it worked. After monitoring the bit registers in the example and in my software I realized my data values for the bit registers in my software were not in their proper locations. Sometime in the past I rearrange the addresses of the bit registers which became the source of the problem. Now my software works and there was nothing wrong with the hardware to begin with.

    Thank you for your help. 

  • Daryl-  We're glad you got it working, thanks for letting us know!

    Regards, Joe