Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

TMSF28335: ADC with 2 sequences (not cascaded)

$
0
0

Hello,


I want to start 2 ADC sequences in the TMSF28335

The first sequence is initiated by PWM1-CMPB. This is SOC-A

The second sequence is initiated by PWM2-CMPB. This is SOC-B

After connecting SOC-A to GPIO32 and SOC-B to GPIO33 I saw them with oscilloscope.

I set ADC to work simultanious mode: 2 samples / cycle.

First sequence contains 3 convertions (3x2 samples)

Second sequence contains 4 convertions (4x2 samples)

After running the code I saw that ADCRESULT6, ADCRESULT7 are not 0x0. It seems they contain samples.

But according to the code they should be 0x0.

What am I doing wrong ?

Following is my code.


Thanks,

Zvika



//PWM1

EPwm1Regs.TBPRD = 2000;

EPwm1Regs.TBCTR = 0x0;

EPwm1Regs.CMPB = 300;

EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;

EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;

EPwm1Regs.ETSEL.bit.SOCAEN = 1

EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTRU_CMPB; //CMPB up count

EPwm1Regs.ETPS.bit.SOCAPRD= 1;


//PWM2

EPwm2Regs.TBPRD = 2000;

EPwm2Regs.TBCTR = 0x0;

EPwm2Regs.CMPB = 300;

EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;

EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;

EPwm2Regs.TBPRD = 2000;

EPwm2Regs.TBCTR = 0x0;

EPwm2Regs.CMPB = 300;

EPwm2Regs.ETSEL.bit.SOCBEN = 1

EPwm2Regs.ETSEL.bit.SOCBSEL = ET_CTRD_CMPB; //CMPB down count

EPwm2Regs.ETPS.bit.SOCBPRD= 1;

//ADC

AdcRegs.ADCTRL1.bit.ACQ_PS = 0x2;

AdcRegs.ADCTRL1.bit.CPS = 0x0;

AdcRegs.ADCTRL1.bit.SEQ_CASC = 0x0;

AdcRegs.ADCTRL1.bit.CONT_RUN = 0x0;

AdcRegs.ADCTRL2.bit.EWPM_SOCA_SEQ1 = 0x1;

AdcRegs.ADCTRL2.bit.EWPM_SOCB_SEQ2 = 0x1;

AdcRegs.ADCREFSEL.bit.REF_SEL = 1;

AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 2; //2+1 conversions

AdcRegs.ADCMAXCONV.bit.MAX_CONV2 = 3; //3+1 conversions

AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;

AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1;

AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2;

AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0x5;

AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x4;

AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0x6;

AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0x3;

AdcRegs.ADCTRL3.bit.ADCCLKPS = 0x2;

AdcRegs.ADCTRL3.bit.SMODE_SEL = 1;


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>