Hi all,
I am re-writing some of the "DMC-library" drivers from F2808 to F28335.
I have some difficulties with the ADC Driver.
I have simply coded:
// Enable CNT_zero interrupt using EPWM1 Time-base
EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable EPWM1INT generation
EPwm1Regs.ETSEL.bit.INTSEL = 1; // Enable interrupt CNT_zero event
EPwm1Regs.ETPS.bit.INTPRD = 1; // Generate interrupt on the 1st event
EPwm1Regs.ETCLR.bit.INT = 1; // Enable more interrupts
to generate 30Khz interrupts for the motor application.
Then I configure the ADC like this:
#define ADC_RESET_FLAG 0x4000
AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; // Reset the ADC Module
asm(" NOP ");
asm(" NOP ");
InitAdc();
// Configure ADC
AdcRegs.ADCMAXCONV.all = 0x0000; // Setup 1 conv's on SEQ1
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA0
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
This is just for testing and later I will add yet another conversion for the other channel.
The behaviour I get is very suspicious. See watch view below:
ADCRESULT0 = 0x0020
ADCRESULT1 = 0x0020
ADCRESULT2 = 0x0020
ADCRESULT3 = 0x0030
ADCRESULT4 = 0x0020
ADCRESULT5 = 0x0030
ADCRESULT6 = 0x0020
ADCRESULT7 = 0x0020
ADCRESULT8 = 0x0000
ADCRESULT9 = 0x0000
ADCRESULT10 = 0x0000
ADCRESULT11 = 0x0000
ADCRESULT12 = 0x0000
ADCRESULT13 = 0x0000
ADCRESULT14 = 0x0000
ADCRESULT15 = 0x0000
ADCTRL3 = 0x00E0
ADCST = 0x0001
ADCREFSEL = 0x219E
ADCOFFTRIM = 0x01FD
Somehow It makes more conversions than I want. It is writing to 8 result-buffers and I can not see why.
Thanks,