Hi,
Is it possible to do a DMA transfer of the ADC result register on The COCO bit?
Not talking about hardware triggering(PDB or TRGMUX), I'm not there yet. Just start a conversion and use DMA transfer complete or MAJOR LOOP interrupt to move the result . just initialize the DMA_TCR properly and enable DMA transfer in the ADC module, Is this all there is to it?
How do I link the COCO bit with the DMA channel?
Thanks,
Koorosh Hajiani
Solved! Go to Solution.
Hi Koorosh,
It depends which MCU version do you have. There was changes in DMA request mapping across MCU revisions. The Excel sheet mentions this too. Thus use
Slot # 40 … for MCU rev 1 (mask 0N77P)
Slot # 42 … for MCU rev 2 (mask 0N47T) or rev2.1 (0N57U)
The back-to-back operation enables the ADC conversions complete to trigger the next PDB channel pre-trigger and trigger output. In other words, next PDB trigger is started automatically once previous conversion is completed.
BR, Petr
Hi Petr,
Thanks for your response,
I looked at your example, just a few questions please:
In the following statement
DMAMUX->CHCFG[0] |= DMAMUX_CHCFG_SOURCE(40); // ADC0 COCO is the source of the DMA0 channel
There is a spread sheet attached to Reference manual that actually list the slot number as 42 . Do we need to change 40 to 42?
back to back PDB indicates TRIGERS take place back to back?
Sorry this is my first attempt to do DMA in this Micro.
.
Thanks,
Koorosh Hajiani
Hi Koorosh,
It depends which MCU version do you have. There was changes in DMA request mapping across MCU revisions. The Excel sheet mentions this too. Thus use
Slot # 40 … for MCU rev 1 (mask 0N77P)
Slot # 42 … for MCU rev 2 (mask 0N47T) or rev2.1 (0N57U)
The back-to-back operation enables the ADC conversions complete to trigger the next PDB channel pre-trigger and trigger output. In other words, next PDB trigger is started automatically once previous conversion is completed.
BR, Petr
Hi Petr,
Thanks for the response.
Just one last question,
Why are we assigning the same input to 4 different channels?
for instance if we were doing 4 back to back conversions on 4 different inputs (ADC0_SE12,ADC0_SE13,ADC0_SE14,ADC0_SE15), It would look something like this:
ADC0->SC1[0] = ADC_SC1_ADCH(12); /* Select AD12 (ADC0_SE12) */
ADC0->SC1[1] = ADC_SC1_ADCH(13); /* Select AD13 (ADC0_SE13) */
ADC0->SC1[2] = ADC_SC1_ADCH(14); /* Select AD12 (ADC0_SE14) */
ADC0->SC1[3] = ADC_SC1_ADCH(15); /* Select AD12 (ADC0_SE15) */
Is that correct?
Thanks
Yes, the same channel was used in the example, but you can select whatever channel.
BR, Petr