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.

TMS320F28386S: F2838xS - ADC interleaving

Part Number: TMS320F28386S
Other Parts Discussed in Thread: TMDSCNCD28388D, C2000WARE

Hello Team,

I'm working with a customer to interleave 2 or 4 ADC within the F2838xS, using the TMDSCNCD28388D. 

On the P650 interleaving would work ok since there is a delay option to trigger the ADC via the timer. 

For the F2838xSI want to ask if something similar to the MSPM0 would be possibile. 

for two ADC:

I want to achieve same sampling time between samples, which are taken by two ADC, working in interleaving mode (same input).

On the MSPM0, I can use a timer, with two compare units, and each compare unit is set to make a PWM signal, at same frequency and complementary output to the other compare unit. 

The output signal of each compare unit triggers one ADC. In this way I can trigger two ADCs with the same frequency, but out of phase.

The result is that distance of each sample is the same, and the result sampling frequency of the two ADC together is twice the single ADC.

  • Can the C2000 timer and two compare units trigger two different ADC (one per compare unit)?
  • Can I do it with 4?

The problem of using different timers, is that I may not be able to get exact sampling period, due to the configuration overload and different start time. 

Thanks,

Mauro 

  • Hello Mauro,

    The ePWM module has two ADC event triggers for each module - ADCSOCA and ADCSOCB. Each of these can be triggered at a different counter compare, so you could have SOCA trigger at the beginning of the period and SOCB halfway through the period, for example. You don't need to use up two different ePWMs to achieve this.

    Best regards,
    Ibukun

  • Thanks for the follow up. What you have described would work if I would interleave 2 ADC.

    If I want to interleave 3-4? 

    Should I use 2 timers? (one for each 2 ADC?)

    Can I sync the two timers so that I can trigger the 4 ADC with the right trigger (keeping the sample period the same)?

    Last resources would be to check the assembly code lines that gets executed by starting the first timer and the second.

    By checking it I can anticipate/delay the counter to load on the timers. 

    Thanks, 

    Mauro 

  • Hello Mauro,

    Apologies for the delay responding as I was out of office.

    This depends on what you're trying to achieve. If you want to trigger multiple ADCs on the same event, you don't need to use multiple PWMs/timers. The same ADCSOCA/B signal can trigger multiple ADCs at once. So the number of SOCA/B trigger signals you need is determined by how many different points in time you want to start an ADC conversion - for a particular trigger, you could trigger as many SOCs as you want to.

    If you do need to space them out at different time points, then yes you would need to use more than one ePWM. You can synchronize the PWM periods and configure them such that you can trigger your ADC SOCs at the exact cycle in the period you wish to.

    Best regards,
    Ibukun

  • Thanks for the follow up.

    The scenario would be the second one:

    If you do need to space them out at different time points, then yes you would need to use more than one ePWM. You can synchronize the PWM periods and configure them such that you can trigger your ADC SOCs at the exact cycle in the period you wish to.

    Do you have an example/recommendation to sync two timers, so that the sampling period of the 4 ADC out the two timers, would be equally distanced.

    Thanks,

    Mauro

  • Hi Mauro,

    Yes, you can have several EPWM's running at the same time (synced) to trigger ADCSOCs equally distanced in time. 

    Have you also had a chance to look at some of our ADC SOC examples in C2000Ware to see if they can be leveraged for your requirements? They are located at {C2000Ware}\driverlib\f2838x\examples\c28x\adc and are a great reference and starting point for this.

    Best Regards,

    Allison

  • Hello Allison,

    thanks for the follow up. 

    from a look to the examples, the interleaved one is interleaving 2 ADC, thus with a timer could be done. 

    Using more than 2 ADC the challenge would remain.

    You have mentioned that I could sync more timers.

    I have taken a look to the timers examples, and there is no reference on how to sync those. 

    Can you point this out?

    By MSPM0 I can use the shadow register of each timer. I can set the timers to load the shadow register with a common trigger. I set the trigger....

    ...the timers load the shadow registers and start Synced.

    How would it work on the C2000 to get more Timers Synced? 

    Thanks 

    Mauro

  • Hi Mauro, 

    To clarify are you trying to use the CPU Timers for this? Or are you talking about using the EPWMs? Are you trying to trigger ADC SOCs on three different instances of ADCs at the exact same time or staggered but the same frequency? If they are at the exact same time, you can trigger all ADC SOCs using a single PWM, but if you are staggering, you simple need to offset the PWM frequencies. Perhaps I am misunderstanding what your target configuration is though - would you be able to quick sketch out a diagram to show the expected timings you are targeting between the ADCs/timer/PWMs?

    The EPWM modules can generate ADC SOCs and interrupts at a configurable rate (frequency of the PWM), and you can easily synchronize the PWMs and offset (if needed) the frequency of the PWMs so that any cyclic events (occurring every period of the PWM) take place in a staggered manner across the PWMs.

    • The use of EPWMs to trigger ADC SOC events and interrupts is explained in the TRM section 26.10 Event-Trigger (ET) Submodule.
    • The principle of EPWM synchronization is also explained in the TRM starting in section 26.4.3.3 Time-Base Counter Synchronization.

    • The ADC examples I already mentioned showcase using the PWM to trigger ADC SOCs
    • The synchronization + offset of PWM signals can be seen in our EPWM synchronization example located in {C2000Ware}\driverlib\f2838x\examples\c28x\epwm - although this doesn't showcase ADC SOCs, this can be easily configured in addition.

    Best Regards,

    Allison

  • Hello Allison,

    thanks for the follow up.

    We are trying to get the max sampling frequency by combining all the ADC together (4 ADC).

    Each ADC will work at the maximum sampling rate. 

    To get an equivalent sampling frequency 4x the maximum sampling frequency, each ADC must get the trigger 1/4 of the period of the maximum sampling frequency away from the other ADC. So that all the ADCs run at maximum speed, and every 1/4 of the period of the maximum sampling frequency each ADC gets the trigger. No ADC works at the same time, but with the trigger 1/4 of the period away. 

    The synchronization of two timers or multiple PWM is important so that each ADC gets the trigger 1/4 of the period away from the other ADC. 

    Using Timer or ePWM is the same, whatever solution can enable the above is ok.

    From my understanding it looks the the ePWM can enable: synchronization, each PWM can trigger an ADC, I can trigger 4 ADC with 1/4 the maximum sampling period away from other ADC. 

    If we can get it, we have interleaved 4 ADC.

    Thanks, 

    Mauro

  • Hi Mauro,

    Thanks for the information. Yes, the EPWM would be my suggestion to accomplish this. You can have 4 synchronized + offset PWM waveforms regularly triggering the 4 ADCs. EPWM interleaving is also featured in the TRM in the PWM topology examples section (26.13 Applications to Power Topologies) that shows 3 PWMs offset in phase. This can easily be adjusted for 4 PWMs using the formula I highlighted in the image below to calculate the TBPHS value to equally offset the PWMs

    For software, I would recommend referencing the two examples (EPWM synchronization and ADC SOC PWM example) as starting points. Let me know if you have further specific questions regarding how to implement this!

    Best Regards,

    Allison