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.

TMS320F28379D: Simultaneous data acquisition on multiple channels on C2000 launchpad XL TMS320F28379D -- Ver(2.0)

Part Number: TMS320F28379D

Hi all,

Looking for a working example that successfully perform ADC and then data acquisition on multiple

channels (2 at a time) given the abovementioned system. This is not our first inquiry on this problem

and already have chatted with our friends there Devin Cottier and Joseph Casuga.We really appreciate

their suggestions and thoughts on this. Both Devin and Joseph have suggested that we look into the

two examples: adc_soc_epwm and adc_soc_continuous, both available at

.../device_support/f2837xd/examples/cpu1.

To exactly quote one of really useful Joseph's message from few months ago:

-- "There are several examples too in C2000Ware where you can see how concurrency for ADC conversions work.

One example is suggest for you to look at is "adc_soc_epwm". In this example, it shows you how to configure the

epwm to trigger ADC conversions. Each EPWM has 2 start of conversion (SOC) triggers. You can use these SOC

signals from the epwm to trigger different channels from different ADC modules of the TMS320F28379D for true

concurrent conversion where 2 channels are converting at the same time. In the "adc_soc_epwm" example, only

one ADC module is shown. You can just duplicate the ADC setup to configure the other ADC module you want to

use for concurrent conversion (note that the TMS320F28379D has 4 ADC modules). In this context, 2 ADC modules

have to be running exactly at the same time (same ADCCLK rate and ACQPS for the ADCs that are active) and

conversion is triggered by the same epwm SOC.

There is also another mode where you can convert on different channels on the same ADC but conversion has to

follow the SOC order (e.g. - SOC0 converts first before SOC1 and SOC2 has to convert before SOC1....and so forth),

but this is not concurrent and rather sequential. A good example to look at that illustrates how this is carried out

is "adc_soc_continuous". " --

Also wonderful feedback and suggestions from Devin and to quote one of his messages:

-- "The next step you need to take is to thoroughly read the ADC chapter of the TRM and then run

the workshop lab.  Look at each line in the code and reference against the bit and functional descriptions

in the TRM until you understand why the lab works.  Repeat for the epwm example.

Once you understand both examples, use the hints from my previous post to extend one example

or the other to sample multiple ADCs in parallel. Note that there is also a mini code-snippet example

in the TRM about sampling multiple channels simultaneously that you can refer to."

My colleagues and I have followed closely these suggestions in regard to adc_soc_epwm example

as well as one of the examples (Lab2) from the following multi-day workshop: processors.wiki.ti.com/.../C2000_Multi-Day_Workshop

Lab2: Analog-to-Digital Converter

None of our tries have been successful so far and only detected & achieved data acquisition

through a single channel. The Lab2 example works nicely using sinusoidal data but only

for a single channel. We modified the example's code in order to handle multiple channels

but nothing were detected for more than a single channel.

** I think we are either totally misunderstanding the hardware or quite likely have missed

specifying some very key components in our code. If someone has an example regardless

of how simple or complex it is and willing to share it with us just to try out we would appreciate it.

Any type of ADC example that would do concurrent data acquisition over multiple channels would be

fine. The objective here is to see how such a setup is done. Once we understand the framework

we will continue trying out our understanding for other examples as we continue using the hardware.

The key point here is just understanding not copying someone else's work.

The hardware is relatively new (roughly over a year or so) to all of us involved and plan to use it

extensively over the coming months in conjunction with other processors for a number of radar

and sensing projects we currently have in the pipeline. Therefore it is crucial that we thoroughly

understand it via running different examples over cpu1 and cpu2 exploiting and utilizing all of

of the channels in different ways (sequential, concurrent, parallel, etc.) in order to harness the true

power of the system.

Many thanks,

Saleh, Joel, Glen and other colleagues.

  • Hi Saleh,

    Fundamentally:

    • To get multiple simultaneous conversions you will use multiple ADCs
      • The same SOC on each ADC (e.g. SOC0 on ADCA and SOC0 on ADCB) has
        • Identical trigger source (e.g. ePWM1 SOCA)
        • Identical S+H duration (e.g. ACQPS = 99)
        • Same of different values of channel select (e.g. ADCA SOC0 CHSEL = 0 which will sample channel A0 and ADCB SOC0 CHSEL = 1 which will sample channel B1) which will always result in different channels being sampled (e.g. if both have a value of '0' the sampled channels will be A0 and B0 which are physically different channels)
      • When the selected trigger occurs, all SOCs configured for that trigger are set to pending
        • e.g. if SOC0 on ADC A and ADC B are both set to accept ePWM1 SOCA, when the trigger occurs, SOC0 will be set to pending conversion on both ADCs at the same time
      • The SOC on each ADC with highest priority begins converting immediately
        • e.g. If all the ADCs are idle and only SOC0 is used, SOC0 will begin converting immediately on all ADCs.  
        • e.g. If all the ADCs are idle and each ADC has SOC0, SOC1, and SOC2 pending, then the one SOC with highest priority on each ADC will begin converting (probably this is SOC0, but refer to the ADC chapter in the TRM to understand the various priority schemes)
      • Once the SOCs are done converting (which should occur at exactly the same time for all ADCs), results will be available in the corresponding results registers
        • SOC0 results go in ADCRESULT0, SOC1 results go in ADCRESULT1, etc. 
        • results from ADCA go into AdcaResultRegs, results from ADCB go into AdcbResultRegs etc.
        • Note that results from e.g. channel 3 do not necessarily go into ADCRESULT3 (unless SOC3 was used to do the conversion)

    Note that A channels (e.g. A0, A1, A2, etc.) can only be sampled on ADCA, B channels only on ADCB, etc. 

    It may also be useful for your understanding and to verify channel hook-up to build an example where you sample multiple channels, but sequentially.  e.g. setup ADCA SOC0, SOC1, and SOC2 to use the same trigger, any valid ACQPS settings, and different channels.  After the trigger occurs and the results are available, result of channel selected by SOC0 will be in ADCRESULT0 of ADCA, result of channel selected by SOC1 will be in ADCRESULT1 of ADCA, and result of channel selected by SOC2 will be in ADCRESULT2 of ADCA

  • Hi Devin,

    We really appreciate your thoughts on this. Apologies I didn't get the chance
    to work on this earlier. Our schedules are pretty crazy since we have multiple
    ongoing projects all going on at the same time.
    Will review again while going over the code. We think there are a couple of things:
    1. either our logic wasn't correct or 2. quite likely we left out a bunch of necessary
    code/config/setup, hence couldn't activate the other channels.
    Will closely review and follow your latest thoughts on this. Will email back soon
    after I get the chance to do the review.

    Many thanks and talk to you soon.

    All the best,
    Saleh & colleagues...
  • Hi Saleh,

    No worries; you can develop on any schedule that works for you.  (We may close the thread if it is idle for a week or two; if so feel free to reply to the thread to re-open it, or use the 'ask a related question' button to continue the discussion)

    Once you have decided on the configurations you want to use, I find that a good sanity check/debug strategy is to run through all the initializations (or maybe even into the active portion of the code) and then:

    • Stop the code (via 'pause' operation of the debugger, or via a HW or SW breakpoint)
    • Examine the configurations of the ADC (and ePWM or CPU timer if you are using one as a trigger source) in the expressions window

    If the actual configurations match what was intended to be written, but the system still doesn't work, then you need to go refine your understanding.  This avoids the very confusing situation where a missing 'EALLOW' or some vestigial code prevents or overwrites your intended configurations, resulting in bad operation even if your intended configurations are otherwise correct. 

    If you stop the code in the active portion, you can also use this method to go examine the ADC or ePWM module state (e.g. ADC RR pointer or current ePWM count), which can be another useful debug or sanity check.  

  • Hi Devin,
    Many many thanks for your thoughts and guidance on this issue.
    It is something quite crucial for us.
    Sorry for the rather slow responses on my part. Our schedule still quite
    hectic trying to handle a number of hard deadline before the holiday.
    Work in progress and will be in touch with you again very soon. If
    possible, don't lock up this thread... I know I could initiate another
    one but I guess for the time being lets stay on it.

    -Saleh
  • Hi Saleh,

    Sure, we can keep the thread open with some activity about once a week
  • Hi Devin,

    Things are quite hectic but my colleagues and I really need to wrap up
    this project before the holidays, if all possible. Therefore I guess will be
    in touch for more thoughts and questions very soon.
    Many many thanks for all of your valuable suggestions, thoughts and
    comments. We really appreciate it.

    Best,
    Saleh, Joel and Glen.
  • Many thanks Devin. A bit more work on this over the next
    few days or so before colleagues head out of town for the
    holidays. Will drop a couple more thoughts and Qs soon.
    Merry Christmas.
  • Hi Saleh,

    I'm going to go ahead and close this thread. You can re-open it by replying or, if it locks (which I think will happen in about 10 days), you can use the 'ask a related question' button.
  • Hi Devin,

    Give me another week or so. Please keep it open. Colleagues are all out of
    town so been trying my best to wrap things up. Would need few more days
    and probably including the entire first week of Jan.
    Hope to chat with you soon. I have few questions & thoughts on our work.

    Wish you a wonderful new year.

    Best,
    Saleh
  • Back looking into the ADC multi-channel data acquisition code ...

    -Saleh