Other Parts Discussed in Thread: CONTROLSUITE
Hello,
I have two questions regarding the ADC module of the F28377s.
I've been working with the F28335 for a while and now I want to migrate my code to the F28377s Launchpad. Basicaly what I want to do is start the ADC conversion when the zero event of ePWM2 occurs.
First question: I had a hard time figuring out what value should I define in the AdcaRegs.ADCSOC0CTL.bit.TRIGSEL register. Is there a document that describes every register of the 28377s like the SPRU812A for the 28335?
Second: After some research I'm able to trigger the ADC SOC and generate an interrupt at the end of conversion, but the value AdcaResult register never change, regardless the voltage applied at the pin.
This is the code I'm using to configure the ADC module:
EALLOW; // Re-map function used by ADCA interrupt 1 PieVectTable.ADCA1_INT = &ADC_A1_ISR; EDIS; // Enable CPU interrupts from group 1 IER |= M_INT1; // Enable ADCA interrupt 1 in the PIE: Group 1 interrupt 1 PieCtrlRegs.PIEIER1.bit.INTx1 = 1; EALLOW; // Reset ADCA DevCfgRegs.SOFTPRES13.bit.ADC_A = 1; // Release ADCA from reset DevCfgRegs.SOFTPRES13.bit.ADC_A = 0; // Set ADCA clock divider - SYSCLOCKOUT /4 AdcaRegs.ADCCTL2.bit.PRESCALE = 6; // Set ADCA mode AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); //Set pulse positions to End of conversion AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; // Power up the ADC AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; // ADC power up delay DELAY_US (1000); // SOC0 will convert pin A0 AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; // Sample window size (75 ns) AdcaRegs.ADCSOC0CTL.bit.ACQPS = 14; // Trigger SOC0 on ePWM2 AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 0x7; // End of SOC0 will set interrupt 1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 0; // Enable ADC A interrupt 1 AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // Clear interrupt flag for ADC A interrupt 1 AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; EDIS;
Can someone please help me on this?
Thanks in advance.