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 F28027 Software Driver Model

Hi,

I am using F28027 and I want to drive ADC in such a way it starts the conversion on CPU Timer0 interrupt.

If I write values directly into the peripheral’s registers I have to type the following line: 

AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

but in this case I want to use Software Driver Model. I have found that to set SOC0 start trigger on EPWM1A it is necessary to type:

ADC_setSocTrigSrc(myAdc, ADC_SocNumber_0, ADC_SocTrigSrc_EPWM1_ADCSOCA); 

So, what is the corresponding line for CPU Timer0 interrupt?

Best regards.

  • Hi Giuseppe,

    In CCS, if you put your cursor in the middle of "ADC_SocTrigSrc_EPWM1_ADCSOCA" and then hit F3, you will jump to where ADC_SocTrigSrc_EPWM1_ADCSOCA is declared. Next to it you will find all the other definitions!
  • Hi Devin, 

    thanks for your reply. I have solved my problem with your suggestion, but now I have another two questions (I add this figure to clarify better what I want to do).

    • I want to use the ADC in continuous mode. To do this it is necessary to use, as trigger source, the feedback ADCINT1 generated by the Interrupt Unit as a result of a EOC. I am not able to find a line of code to set the register that drive the second mux (red arrow).  Here I attach the piece of code I use:

    // Initialize the ADC
    ADC_enableBandGap(myAdc);
    ADC_enableRefBuffers(myAdc);
    ADC_powerUp(myAdc);
    ADC_enable(myAdc);
    ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Int);

    // Configure ADC    
    ADC_setIntPulseGenMode(myAdc, ADC_IntPulseGenMode_Prior);                                                             //ADCINT1 trips after AdcResults latch
    ADC_enableInt(myAdc, ADC_IntNumber_1);                                                                                                      //Enabled ADCINT1 (INT1E)
    ADC_setIntMode(myAdc, ADC_IntNumber_1, ADC_IntMode_EOC);                                                            //Enable ADCINT1 Continuous mode (INT1CONT)
    ADC_setIntSrc(myAdc, ADC_IntNumber_1, ADC_IntSrc_EOC1);                                                                  //setup EOC1 to trigger ADCINT1 to fire (INT1SEL)
    ADC_setSocChanNumber (myAdc, ADC_SocNumber_0, ADC_SocChanNumber_A4);                          //set SOC0 channel select to ADCINA4 (CHSEL)
    ADC_setSocTrigSrc(myAdc, ADC_SocNumber_0, ADC_SocTrigSrc_Sw);                                                  //set SOC0 start trigger on Software (TRIGSEL)
    ADC_setSocSampleWindow(myAdc, ADC_SocNumber_0, ADC_SocSampleWindow_7_cycles); //set SOC0 S/H Window to 7 ADC Clock Cycles (ACQPS)

    • Does SOC have an inner buffer or only one associated register (for example SOC0 > ADCRESULT0)? I would use a buffer to store data and improve the sample rate (2MHz).

    Best Regards