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 initialization in cascade mode

Other Parts Discussed in Thread: TMS320F28335

Hi,

My question is with ADC initialization. I am trying to use cascade mode to utilize all the 16 available pins from ADC. I check with C2000 example file for ADC, which used SEQ1 to initialize ADC A 2, 3. For my system I am using epwm 6 as a interrupt where, I am storing the ADC values and ADC is initialize in the main program. Please find my sample initialize program for ADC cascade mode attached. The program is able to access and read all 16 channels. However, my query is that I have not used any SOC from epwm 6 B to start the ADC conversion as it is done in the sample code for C2000. So is my coding is good to use?

AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // This helps the sequencer to iperate in continuous mode and not in start stop mode
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // This will set the ADC to operate in cascade 16 bit mode
AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1; // Start of convertion for cascade sequence
AdcRegs.ADCTRL3.bit.SMODE_SEL = 0; // This sets the sequential sampling mode

AdcRegs.ADCMAXCONV.all = 0x000F; // Setup maximum conversion. For 6 convertion set it as 0005.

AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA0 in cascasde mode.
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; // Setup ADCINA1 in cascasde mode.
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2; // Setup ADCINA2 in cascasde mode.
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3; // Setup ADCINA3 in cascasde mode.
AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4; // Setup ADCINA4 in cascasde mode.
AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5; // Setup ADCINA5 in cascasde mode.
AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x6; // Setup ADCINA6 in cascasde mode.
AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x7; // Setup ADCINA7 in cascasde mode.
AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0x8; // Setup ADCINB0 in cascasde mode.
AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x9; // Setup ADCINB1 in cascasde mode.
AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xA; // Setup ADCINB2 in cascasde mode.
AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xB; // Setup ADCINB3 in cascasde mode.
AdcRegs.ADCCHSELSEQ4.bit.CONV12 = 0xC; // Setup ADCINB4 in cascasde mode.
AdcRegs.ADCCHSELSEQ4.bit.CONV13 = 0xD; // Setup ADCINB5 in cascasde mode.
AdcRegs.ADCCHSELSEQ4.bit.CONV14 = 0xE; // Setup ADCINB6 in cascasde mode.
AdcRegs.ADCCHSELSEQ4.bit.CONV15 = 0xF; // Setup ADCINB7 in cascasde mode.