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/TMS320F28377D: What is ADC process to get the sampled values ready for control logic part?

Part Number: TMS320F28377D

Tool/software: Code Composer Studio

Hi,

Could anyone help me with this? I really read the ADC reference a lot  but still I don't really understand how the ADC value is ready to use and don't know how to check to see if it is right. Could you please correct what I understand 1,2,3?

ePWM2SOCA is trigger for A0, A1, B0 on zero match

ePWM3SOCA is trigger for B4 on period match

Both ePWMs are up-down mode and both are syn. with ePWM1.

1. ePWM2SOCA and ePWM3SOCA arrive at the same time.

2. A0+B0->A1->B4 sequentially are sampled or actually A0-A15 and B0-B15 all are sequentially sampled?  Is there a need to wait for the time base counter of ePWM3 to reach to the period then get B4 sampled?

3. Set EOC4 as trigger for interrupt ADCB1 and values from A0, B0, A1, B4 are transferred to the result regs. Or do I need to set two interrupts ADCA1 and ADCB1 because I use two trigger sources?

  • Hi Hongwei,

    Could you please indicate the reference or documentation that you were referring to for the 3 items you have pointed out?  This way, we could better address your questions.

    Thanks and regards,

    Joseph

  • Hi Hongmei,

    If the triggers will always arrive at the same time, then you should probably use a single trigger.

    Assuming they both arrive at exactly the same time, the following will happen (assuming SOC0 is high priority for both ADCA and ADCB):

    SOC pending flags set for ADCA SOC0 (A0) and SOC1 (A1) and flags set for ADCB SOC0 (B0) and ADCB SOC1 (B4).

    Both ADCs start working on their first conversion with the highest priority = SOC0 for both, so A0 and B0 get converted in parallel. After those are completed, they will do SOC1 each, so A1 and B4 will get converted in parallel. At that point, a single interrupt based on EOC1 from either ADC would be fine to go collect the data. After this process, both ADC's highest priority SOC will be SOC2.

    The next time the triggers come in, assuming the again occur at exactly the same time, will result in SOC0 for both going first again. This is because SOC2 is the highest priority for both, the next highest is SOC3, then SOC4, ... etc until it wraps around to SOC0 (so SOC0 will take priority over SOC1).

    You might want to read through the section "ADC Conversion Priority" in the TRM: www.ti.com/.../spruhm8g.pdf

    Note, if the triggers don't arrive at the exact same time, then the SOC(s) from whatever trigger arrives first will convert first and the order of conversions will be determined by the current RR pointer status.
  • Thank you VERY much, Devin.
    It helps me a lot.
    There are 15 SOCs. If I only configure SOC0, SOC1, does the conversion time is only for SOC0 and SOC1 or still should be the time of total 15 SOCs because it goes around? When EOC1 set and the interrupt starts, the ADC still do other un-used SOCs before the ADC trigger comes?
    Thanks!
  • Hi Hongmei,

    The SOCs won't convert unless you configure the trigger for them. So if SOC0 and SOC1 have trigger = ePWM, when that trigger comes only those two will convert.

    The only thing that 'wraps around' is the priority: if SOC1 was the last SOC to convert, then it has the lowest priority and SOC2 has the highest. If another trigger comes in for SOC0 and SOC1, then SOC0 will go first again because priority at that point is SOC2 > SOC3 > SOC4 >...>SOC15 > SOC0 > SOC1, so SOC0 has the highest priority of the two that are pending.

    If you trigger SOC0 and SOC1 you could actually trigger an ISR from the EOC of either. If you trigger an ISR on EOC1 then both should be complete (which is usually what you want). If you trigger an ISR on EOC0 then SOC1 will still convert, but it may not be complete by the time you try to read the result in the ISR. If you only trigger SOC0 and SOC1 and setup the ISR to occur on EOC2, then the ISR will never be reached.
  • BIG THANK YOU, Devin.