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.

CCS/TMS320F28027: F28027

Part Number: TMS320F28027

Tool/software: Code Composer Studio

Dear C2000 picollo team,

I have one questions about F28027 ADC module,  I initiate the ADC module as belows step by step:

1. single sample mode

2. config all ADCSOCxCTL.bit.CHSEL (x=0 to 15)

3. config all ADCSOCxCTL.bit.TRIGEL = 0 (x=0 to 15)

4. config all ADCSOCxCTL.bit.ACQPS = 6 (x=0 to 15)

5. AdcRegs.INTSEL1N2.bit.INT1E = 1

6. AdcRegs.INTSEL1N2.bit.INT1SEL = 15

After that, I try to start a convertion by set the register AdcRegs.ADCSOCFRC1.all = 0xFFFF, and I planed to read all RESULTx registers after check the ADCINTFLG.bit.ADCINTx=0 as below:

while(AdcRegs.ADCINTFLG.bit.ADCINT1 ==0) { }

AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;

Data0 = AdcResult.ADCRESULT0;

...........................

Data15 = AdcResult.ADCRESULT15;

My question is:

Under single step mode with xds100 emulator, I found everytime when I set AdcRegs.ADCSOCFRC1.all = 0xFFFF, the ADCINTFLG.bit.ADCINT1 is set to 1 immediately, I thought this register will be set after all 16 channels' convertion is completed, but the real condition is NOT. What wrong with me? Thanks a lot.

  • Hi simone,

    Single-stepping the debugger doesn't prevent HW modules from continuing to operate, only the CPU is paused/stepped. You can actually go in the expressions window while the device is at a breakpoint and write 0xFFFF to the SOC force register - this will cause the ADC to convert these channels which you can see as updated ADC result values.
  • Dear Devin,
    Thanks for your reply.

    1. I could not found expression window on CCS3.3.83.20, where does it locate?
    2. The question mentioned above is a software triggered sampling example for my project, In fact, I need use EPWM1SOCA to trigger all 16-ch convertions when T1CTR=0. I configured the related registers as below:
    (1). ADCSAMPLEMODE = 0xFF
    (2). config all ADCSOCxCTL.bit.TRIGEL = 5 (x=0 to 15)

    I plan to read all ADCRESULTx register in ePWM1 interrupt service, here below are the code:
    (1). while(AdcRegs.ADCINTFLG.bit.ADCINT1 ==0) { } //waiting for conversion complete
    (2). AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    (3). Data0 = AdcResult.ADCRESULT0; //read result
    ...........................
    Data15 = AdcResult.ADCRESULT15;

    But I found that every time all the data I read is the result of last PWM period, which means that all the data I got is 1 Tpwm period delay.

    During debugging mode, I set a breaking point at line while(AdcRegs.ADCINTFLG.bit.ADCINT1 ==0) { } in ePWM1_isr() function, I found the ADCINTFLG.bit.ADCINT1 is already set to 1 everytime. this cause the waiting instruction is bypassed everytime, and the coming reading instruction read the old converting data for software control.
    WHY?

    3. I checked the reference guide about simutaneous mode sampling, either SOCx's trigger will start a pair of conversion, I thought I may start 16-ch AD conversion twice since I configured all 16 ADCSOCxCTL.bit.TRIGEL = 5, but when I delete the odd SOCx, the problem still present (waiting instruction is bypassed, I get the old conversion data).
    WHY?
  • Another strange condition happened:
    If I just only configure 4 ADCSOCxCTL.bit.TRIGEL = 5 (x=0 to 3) and read 4 ADCRESULTs in ePWM1_isr() routine, the result is correct. It's the newest conversion data.
  • Hi Simone,

    CCS version 3 has a "watch window" which is equivalent to CCS version 4 or greater's "expressions window".

    It may be better to read the ADC results in the ADC ISR to make sure you get the most recent results and don't spend too long spin-waiting inside an ISR. You can certainly read the results inside the ePMW ISR, but you need to be careful of the timings to ensure you get the most recent results. There isn't much direct help I can give here other than to recommend that you carefully diagram the timings of your system, paying particular attention to how things start-up for the first ePWM period.

    Are you calling the ADC self-calibration example function? You may need to clean-up some leftover settings used by that function.