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: Concurrent data acquisition via multiple channels on the F28379D ...

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi all,

Using one of the lab examples provided in the multi-day

workshop that took place few months ago I was able to

display the provided sinusoidal data on a single ADC

channel (connected to pin 30 which is labeled as AA0

on the back of the F28379D board). I gather the other A/D

channels appear to be, for example, on pin 29 (labeled

AA2 on back of the board) as well as the other pins

labeled AA__, ABx and  ACx --..., there are 16 pins in total.

I'd like to know if you could point me to some example code

(or perhaps a modified version of one of those workshop examples)

that would work in such a way to acquire data on say 4 of these

channels concurrently. Would such concurrency in data acquisition

via multiple channels be possible on TMS320F28379D?

If so, would love to see an example showing such concurrency

as well as clearly identifying those involved channels.

Perhaps could be tried out as a separate project on the code

composer studio (v8). Many thanks.

- Saleh

  • Hi Saleh,

    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".

    Best regards,

    Joseph

  • Hi Joseph,

    Many many thanks for the great suggestions and information. I really appreciate it.
    Will take a look at your recommendations shortly. Hope you don't mind me asking further
    questions on this. A colleague and I are trying to figure out the operations of those
    channels. So far we have identified one channel and looks like 3 more to go. As mentioned,
    we were successful to use one of those code examples to capture the sinusoidal from the
    TMS320F28379D board to a 100MHz oscilloscope but that is only through one channel. We would
    like to achieve such acquisitions with other channels at the same time and be able to display all
    of it on the mentioned oscilloscope with direct connection to the board. So I guess the key point
    here is the very immediate goal of ours to pinpoint/precisely identify those 4 channels
    (one down and three to go) in order to accomplish the concurrency I have in mind.

    Thanks again and looking forward to more of your excellent thoughts on this.

    All the best,
    Saleh
  • Hi Joseph,

    Apologies to bug you again but couldn't locate the "adc_soc_epwm" example you
    mentioned. Perhaps was listed somewhere under a different name? I noticed one file
    by the name of EPwm.c but I guess that one is a bit different? Would be really great
    if you could point me to where those examples that hopefully would resolve those
    problems are I'll certainly try to download and check them out.

    Thanks again,
    Saleh
  • Hi Saleh,

    No trouble at all. I hope you have the latest copy of C2000Ware, but previous versions have the examples as well. Anyway, the version I have is 1_00_05_00. The examples can be found in device_support/f2837xd/examples/cpu1. You should see "adc_soc_epwm" and "adc_soc_continuous" along with other examples.

    Best regards,
    Joseph
  • Hi Joseph,

    Again many thanks for your help. Looks like I do have the latest version of 1_00_05_00
    as shown in C2000Ware - v: 1.00.05.00 under the software folder of the code composer
    studio (Version 8.1.0.00011). So I gather those examples will be listed in a sub-folder down
    the hierarchical software tree? Will have a look at it very shortly.
    I'm sure will be asking more questions on this so I very much appreciate it. Looks like it
    is something of an urgent matter to us and we really like to completely solve it before we
    go any further. Our intention is really to fully understand the architecture as well as the
    full functionality of F28379D board we have in order to be of some use to us and then quite
    likely order more of them from TI.

    All the best,
    Saleh
  • Hi Saleh,

    You are welcome.  I hope you will find the examples useful.  There are several applications that the TMS320F2837D (with dual C28x processors and with 4 independent embedded ADC modules and various analog subsystem modules) would be able to support.  If you have further questions on how to use the ADC (or any of the analog peripherals), please do not hesitate to post them in this forum.

    Regards,

    Joseph

  • Hi Joseph,

    I'm working on it for most of this eve so I'm sure will have more
    questions to ask about those ADC modules, channels etc.
    A couple of my colleagues and I plan to make a heavy use of it
    for a number of applications we have around the mechanical, electrical
    and biological domains. It would be in conjunction or coupled with
    our own hardware systems and devices.
    Therefore if all goes nicely and I understand it quite well, I'll definitely
    stick with it. In the mean time, I really do need to make sure I fully
    understand it. I see there is quite a bit of materials there to try out and
    review.
    Back to work and will chat more soon. Thanks again.

    All the best,
    Saleh
  • Hi Saleh,

    I'll monitor the forum for some time tonight and may be able to answer any immediate questions you have. I'll be out of the office for a couple of days but i already notified another ADC expert about this forum post in case you have more questions while i am away. Either way, we will do our best to answer your questions.

    Best regards,
    Joseph
  • Hi Joseph (as well as colleagues there),

    A couple questions or so around the two files you mentioned. I've noticed
    few there so I'd like to make sure that I'm looking at the correct files. I gather
    the "adc_soc_epwm" would be the file listed under adc_soc_epwm_cpu01
    which will be "adc_soc_epwm_cpu01.c" ?
    Same goes for file "adc_soc_continuous" again listed under
    adc_soc_continuous_cpu01 as "adc_soc_continuous_cpu01.c" ?
    Those are the names I've noticed there. Let me know if I have been probably
    looking at the wrong folder and such files would be located somewhere else.

    I have not examined them closely yet but would like for example, just as an example,
    to modify Lab2_cpu01 (one of the multi-day workshop from few months ago) so that
    the ADC (sinusoidal data in this case) would be captured or acquired not only by
    a single channel as shown there in that example but also by multi-channels
    (say 4 channels). Having an outcome of multiple sinusoidal graphs that could be
    shown on the CCS and then through multiple(?) cable connection from F28379D
    board to the oscilloscope for an external display of those sinusoidal multi-graphs.

    Would something like this or along those lines be possible? I thought perhaps to
    just grab one of those already given lab examples, say Lab2_cpu01.c, and then
    modify it in such a way according to the above mentioned files "adc_soc_epwm"
    and "adc_soc_continuous", as you pointed to, in order to involve multiple channels
    concurrently and then display the converted data in a multi graph form ...
    Furthermore, within this ADC process we need to pinpoint or precisely identify
    those involved channels on the board. This latter point is a requirement for us
    since we plan to utilize them in subsequent work.
    Hope these rough questions/thoughts are not too vague or unclear.

    I really thank you for your thoughts on this as well as any suggestions on the
    best possible way to approach or handle all this. Any information in this regard
    is quite welcome and very much appreciated.

    All the best,
    Saleh
  • I gather Joseph is out of the office today and tomorrow as he
    mentioned in his previous reply. Would appreciate any thoughts
    from any of his colleagues there on some of our questions.

    Thanks,
    Saleh
  • Hi guys,

    Any expert out there on the C2000 Launchpad XL TMS320F28379D ?? If so
    would love to chat with you via this forum regarding issues of concurrency
    by the system... as well as on the use of multi-channels during the ADC phase,
    etc. If you happen to be an expert or quite experienced using this system,
    I really would love to chat.

    Many thanks,
    Saleh
  • Hi Saleh,

    If you want to sample 4 channels in parallel start with the adc_soc_epwm project:

    \ti\c2000\C2000Ware_1_00_05_00\device_support\f2837xd\examples\cpu1\adc_soc_epwm

    What you want to do is have 1 trigger source (ePWM in this case) trigger SOC0 on all 4 ADCs and then only 1 ADC triggers an ISR where you collect the data for all 4 ADCs.

    So for the epwm example just duplicate

    Uint16 AdcaResults[RESULTS_BUFFER_SIZE];

    And

        AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //set ADCCLK divider to /4
        AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
        AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
        AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;

    And

        AdcaRegs.ADCSOC0CTL.bit.CHSEL = channel;  //SOC0 will convert pin A0
        AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles
        AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    And

    AdcaResults[resultsIndex++] = AdcaResultRegs.ADCRESULT0;

    For ADCs B through D.

    Probably you can do something similar for the workshop example.  

  • Hi Devin,

    I really appreciate your message and apologies for the late reply.
    It has been a very hectic schedule so have not had much chance to
    take a look at it till just a minute ago.

    I'll take a look at that and will definitely be chatting more with you
    today. One example I had in mind when I start chatting with Joseph
    the other was the example in Lab2 of the workshop. The sinusoidal data
    there go through the ADC then get displayed in the graph module of CCS.
    We also have managed to get the same graph shown in an oscilloscope. All
    that done through one channel that we captured. If there is a way perhaps
    to modify that source a little so that ADC is done through multiple channels,
    hence, multiple displays simultaneously that would be wonderful.
    I gather there are in total 4 channels there and we already figured out one
    of them so now we need to also pinpoint the other three. Our objective in all
    this is to couple/interface the F28379D board with one of our own devices
    which we have built in-house.
    Such an interface would need to be done through those 4 channels.
    As mentioned to Joseph, if we are able to do that we could harness the
    power/functionality of the micro-controller in a much more efficient and
    effective way fashion. Once this becomes successful we intend to order
    more units from TI.
    That is our current plan therefore we now need to understand it quite
    thoroughly. I very much appreciate your help in this regard.

    Cheers,
    Saleh
  • I have now a project that seems to build and run fine on the CCS (workspace_v8)
    as adc_soc_epwm_cpu01.
    The changes you suggested will only involve the source in adc_soc_epwm_cpu01.c or
    also I need to handle other files under the project?

    Could you also suggest another simpler example? Perhaps something along the lines
    of lab2_cpu01 of the workshop to handle a sinusoidal data set or something similar?

    I need to hand all of this over later this week to my colleague who is a hardware engineer
    but not much into the software side ...
    Got a long list of paper deadlines that I really need to take care of.

    Thanks for your help.

    -Saleh
  • Hi Devin,

    The replication of those lines of code would be in the same file? Would they need
    to be moved into certain function(s) within it or anywhere in the file... ?

    Thanks again,
    Saleh
  • Hi Saleh,

    To be blunt, we aren't going to write your application for you.  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.  

    We are more than happy to help with understanding the HW and SW and happy to give some guidance as to the best route to implementation, but I can't just give you the code you want.  This is necessary because you need to be able to support the code you write and extend it further as your application grows.   

  • Hi Devin,

    We are more than capable to code our own in several PLs as well as various

    algorithmic approaches etc. so we are not asking for others to do our work .

    Sorry if you got the impression that I was asking you to do that.

    We acquired a hardware system from you guys that we're trying our best to fully

    understand so we could better utilize it in conjunction with other hardware systems

    we have in-house for a number of planned applications.

    If we don't understand it we just won't be able to use it regardless of how new or

    innovative it is. In any case, thanks for the back and forth chats and really

    very sorry to waste your valuable time as well as for any misunderstanding on this.

    Have a good weekend.

    -Saleh

  • Hi Saleh,

    Sorry, I was just trying to be very direct that I think the next action in getting your application successfully working is on you to understand the documentation and examples a little better.

    We're happy to spend time helping you. Feel free to come back if you run into specific questions about the documentation or about how the SW examples work, or if you get stuck once you move onto implementing the simultaneous sampling.
  • Thanks Devin. I do understand so no problem. A colleague who has a very long experience in
    hardware design as well building circuit boards was supposed to handle all this but unfortunately
    does not have much of strong software background. In any case, he is heading out out of town
    so looks like the project is back to me. The schedule on my side is quite swamped with paper
    deadlines and a couple talks to come but I'll get back at those documents and your suggestions.
    Coding is not the key issue here as far as I understand it, but it is the interplay between software and
    the hardware of the given systems. Therefore I really need to understand the latter quite well.

    In any case, I hope you don't mind me asking more of those questions. If any of those
    questions are not too clear or perhaps I'm asking too much or you have no time to
    reply/answer them, that would be fine as well and no worries.
    Many thanks again and sincere apologies for any misunderstanding.

    Cheers,
    Saleh
  • Hi Devin/Joseph,

    I hope you don't mind if ask about those lines of code replications you suggested.
    Just got the chance to look at adc_soc_epwm_cpu01 project on CCS. It builds nicely
    with no problems. Those lines of code replications are in adc_soc_epwm_cpu01.c
    file so any of those replication would need to take place there?
    I gather some changes would need to be done with F2837xD_Gpio as well as
    F2837xD_DefaultISR, no? I guess would need to dig a little deeper into the code set.

    Thanks,
    Saleh
  • Hi Saleh,

    The ADC inputs aren't muxed with GPIOs, so no changes to GPIO code should be needed. You just need to locate the physical ADC pins on your EVM or board and supply a signal.

    As far as ISRs, you don't need one ISR for each ADC. Since you want to set them up to start and stop simultaneously, one ISR from any ADC should be fine, including the existing one. (However, a good exercise might be to switch the entire example from ADC-A to some other ADC, including the ISR...if you can do this successfully this will help with understanding the example).

    Overall the trigger source already exists in the example (ePWM) so the main thing you have to do is setup the additional ADCs to also take the same trigger source and do some conversions. Most of this is just duplicating the existing ADC configuration code in-place (except that you don't want to duplicate ADC interrupt related code as previously discussed since you only want one ISR).
  • Hi Devin,

    Wishing you an enjoyable Labor Day holiday. Back again to the project to
    hopefully wrap it up soon. Plan to work on it over the weekend so will
    try to keep you posted. Thanks for your very useful pointers and help
    in this regard. I appreciate it.

    All the best,
    Saleh
  • Hi everyone,

    Back to CCS to wrap up our project but noticed a Java-type error that keeps
    occurring at every function:

    In a small window: java.lang.NullPointerException

    Regardless of the function/step taken, it keeps popping up... Any suggestion
    on how to fix this? I really need CCS back in operation to finish our work. We
    don't have much time to start all over again from scratch on this.
    I appreciate any help.

    -Saleh
  • Looks like related to Eclipse I believe but so far unable to resolve. Any help on
    this would be great.
  • Hi Saleh,

    I'd recommend creating a new thread with a detailed description of the CSS issue you are seeing. If you tag this as CCS and not with a specific C2000 part it'll end up in the CCS/Tools forums which will be much better equipped to debug this type of issue.