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.

TMS320F2812 ADC SOC

Other Parts Discussed in Thread: TMS320F2812, CONTROLSUITE

Hello,

Add the moment I want to read out the TMS320F2812 ADC value. The program works when want to do it in continues run, but when I am triggering it whit the SOC_SEQ it just give a 0 zero as result. Could anybody point me in the right direction?

The code is in the attachment.

Kind regards,

Ralf

int main (void)
{
  unsigned int Value;
  /* Initialize the periphery */
  BSP_Init();


  /* Initialize a memory management system */
  GEO_InitMem();

  // Init ADC

  // Specific clock setting for this example:
  	   EALLOW;
  	   SysCtrlRegs.HISPCP.all = 0x3;	// HSPCLK = SYSCLKOUT/ADC_MODCLK
  	   EDIS;
  	  InitAdc();

     AdcRegs.ADCTRL3.bit.SMODE_SEL = 1; // Setup simultaneous sampling mode
     AdcRegs.ADCMAXCONV.all = 0x000;

  	  // Specific ADC setup for this example:
  	  AdcRegs.ADCTRL3.bit.ADCCLKPS     = 1;   // ADC clock 0 = Fclk/1    1 = Fclk/2
 	  AdcRegs.ADCTRL1.bit.CONT_RUN     = 0;   // Stops after each run

     AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x1; // Setup conv from ADCINA1 & ADCINB1

     AdcRegs.ADCMAXCONV.all			= 0;

 // Start ADC
  	  AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;         // Reset SEQ1
  	  AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;       // Clear INT SEQ1 bit
  for(;;)
  {
	  if(AdcRegs.ADCST.bit.INT_SEQ1 ==0)
	  {
  	  AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1; // Start Sequence 1 ADC conversion.
	  }

	  if(AdcRegs.ADCST.bit.INT_SEQ1)
	  {
		  Value = (AdcRegs.ADCRESULT1>>4); // Uitleze nADC

		  AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;         // Reset SEQ1
		  AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;       // Clear INT SEQ1 bit

	  }

  }

  • Hi Ralf,

    I think you would also need to provide the contents of the InitAdc() function to determine how the code operates.

    However, a better path forward would probably be to start with one of the provided ADC examples in ControlSUITE and then incrementally change the code to suit your application. Starting with working code and then incrementally checking the functionality as you move it towards your desired application is definitely the way to go. The example \controlSUITE\device_support\f2833x\vXXX\DSP2833x_examples_ccsv5\adc_soc\ for example does periodic ADC triggering with the ePWM.