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.
Tool/software: Code Composer Studio
Hello - I am trying to do high speed current sampling using the ADC modules. I assigned ADCINAO, ADCINB0 and ADCINC0 to my signals and here is the code that I used for ADC setup:
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0
AdcaRegs.ADCSOC0CTL.bit.ACQPS = 19
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5;
AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = 19;
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 5;
AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;
AdccRegs.ADCSOC0CTL.bit.ACQPS = 19;
AdccRegs.ADCSOC0CTL.bit.TRIGSEL = 5;
However, I am not able to read anything from the corresponding result registers. I guess my trigger source has not been set properly can you please let me know how I need to setup my trigger source? (in this case is ePWM1 SOCB? This is how I did:
EPwm1Regs.ETSEL.bit.SOCBEN = 1;
EPwm1Regs.ETSEL.bit.SOCBSEL = 0x1;
Also if I get this working, what would be the fastest rate to read digital values? Can I get to 1MHz reading rate?
Hi Maziar,
Start with the adc_soc_epwm example in C2000 ware. That should have the epwm to adc triggering setup correctly.
You can then add in additional triggering for additional ADCs as you have correctly mapped out in your comment. You only need one ADC interrupt from a single ADC since all the ADCs will run in parallel.
With S+H time of 100ns, the ADC trigger-to-output latency will be around 350ns. You can probably run an ISR at 1MHz, but it'll be pretty tight. If you run a tight CPU loop (no ISR) 1MHz shouldn't be a problem.
(If you just want to read the data, not run a tight control loop, then just use the DMA instead of the CPU or CPU ISR)
Hi Maziar,
Any luck getting your ADCs to sample and update, and to run at ~1MHz?
Hello Devin - thanks for your help and follow up. Yes I was able to get it work, as you mentioned the problem was in adc triggering source. And I had to correctly set it up.
Thanks,
Maziar