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