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.

TMS320F28375S: ADC tripping count

Part Number: TMS320F28375S

Hello,

I'm using a typical EPWM->ADC->DMA chain to read ADC signal and I need to evaluate how loud the signal is. A trivial solution would be to just walk over the data collected by DMA and compare each value with my limits in software. But then I noticed there are triphi and triplo registers in ADC's PPB, which function in a much similar way. Would it be possible to configure the X-BAR and EPWM to count these trip events over span of 1024 values? 

Thank you

Jiri

  • Hello Jiri,

    Just to clarify, are you asking to compare all 1024 values against a single triphi and triplo? If that's the case, it seems possible with the PPB, as they can compare against a high or low limit using a result register. I'm not sure what you mean by configuring the X-BAR and ePWM to count the trip events, as this would be done by the ADC's PPB.

    Best regards,

    Omer Amir

  • Hello Omer,

    I thought the PPB only generates an event and the counting is done in some EPWM submodule. So I understand the counting is already done in PPB, is there perhaps some sort of counter register which I could read and zero out after 1024 values?

    Thank you

    Jiri

  • Hello Jiri,

    I thought the PPB only generates an event and the counting is done in some EPWM submodule

    This is correct. If you have the ePWM counting for 1024 values, then the counter would need to be handled in the ePWM module not the ADC's PPB. The PPB can generate interrupts and events, but it cannot directly affect some other register in a different peripheral. If you want to change the ePWM's counter or do something like that, I could assign this post to an ePWM expert instead and they will help you.

    Best regards,

    Omer Amir

  • Hello Omer,

    That'd be great.

    Thank you

    Jiri

  • HI Jiri,

    What EPWM event are you using as the trigger source for the ADC? 

    Just for my own understanding, you want to stop EPWM outputs once the ADC has sampled an input voltage 1024 times, or when the sampled input has gone above your defined threshold 1024 times? 

    Could you please provide more details on what exactly you would like to do with the EPWM module?

    Best Regards,

    Marlyn

  • Hi Marlyn,

    For triggering start of conversion I'm using EPWM_SOC_A.

    Generally:

    I'm not quite sure this can be done, I thought I'd have EPWM count how many times the value in ADC result register tripped over defined threshold, then I'd store and zero out this counter in my ISR for DMA (which triggers after 1024 values).

    In detail:

    In the Technical Reference Manual I found it is possible to configure TRIPHI and TRIPLO thresholds in ADCs PPB. Then I found, it is also possible to configure the PPB to generate a DCAEVT, which in turn can trigger EPWM (if XBAR is configured accordingly). And here comes my question: Is it possible to configure EPWM to increment some of it's counters when this event is received? (That way I'd achieve the above)

    Background:

    This is only meant as optimization, it can be done easily in SW by iterating through values and counting how many of them are over threshold. I'm using all four ADCs and I'm also multiplexing them so it could add up to considerable CPU overhead. So I thought I'd alleviate this overhead by having HW do the counting. Purpose of this counting is determining signal loudness.

    Thank you

    Jiri

  • Hi Jiri,

    Thank you for the extra background.

    Then I found, it is also possible to configure the PPB to generate a DCAEVT, which in turn can trigger EPWM (if XBAR is configured accordingly).

    Can you please point out where in the TRM you found that the PPB can generate a DCAEVT? Note that DCAEVT is different from ADCAEVT. 

    The Digital Compare A Event (DCAEVT) comes from trip signals to the Digital Compare Block within the EPWM module:

    Best Regards,

    Marlyn

  • Hi Marlyn,

    Ah yes, my mistake, I did mean ADCEVT. Sorry for the confusion. Not sure how I got it mixed up.

    The image you added is however what I had in mind. Do you think it's possible to use the ADCEVT as a trigger to EPWM for the purpose of incrementing some counter?

    Thank you

    Jiri

  • Hi Jiri,

    No, unfortunately this would need to be done through software. The EPWM module cannot perform such a task based on an ADCEVT. 

    Best Regards,

    Marlyn

  • Hi Marlyn,

    I see, oh well. Thank you very much for your time :)

    Jiri