Sampling 9ADC pins in burst

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello....

 

I have trouble setting ADC and Double buffer DMA. I want to sample 9 ADC pins from PORTA1 to PORTA7 and PORTB0 & PORTB1.
I have set timer0 rollover every 44us, and trigger event0 which trigger ADC. It works as should. The samples are spreaded evenly each every 44us apart. So I get individual channel sample every 396us.

 

But I want to get all 9 samples as close as possible. ADC is capable 2MHz sampling so I wish to get all 9 samples in 4.5us burst and then wait 391us to the next burst as I want as small phase difference between all 9 samples.

 

So I want to accomplish to set timer to overflow every 396us which trigger event0 and then ADC does sampling on all 9 selected channels.

 

The catch can be in EVCTRL register (SWEEP) but I can't get it working, or I missunderstant all the thing.

Is it that possible at all?

 

Device used is XMEGA 128 A3U

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

If I remember correctly (since it has been a while since I used the Xmega family), you can only use the sweep functionality on at most 4 pins at a time and this is something you will need to confirm with the datasheet

 

Ilya

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And also, if my memory serves me right, you could only set up the sweep only for one adc "channel" of 4 pins

 

Ilya

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sadly I have discovered (for now) that SWEEP can work on 4 pins and other ADC SWEEP can work on another 4 pins. But that's still 1 pin short as I need 9 pins. I wan't to figure how to use ADCA.CH0.SCAN register as this value is in question.

 

As I discovered for now the ADC itself can't sweep 9 pins. But maybe there is some option to make EVENT to trigger ADC with correct shape. eg nine fast pulses and one long.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...hmm actually I just got idea how can be done. But need to prove it.

OVF of timer trigger event0 to start ADC.

But in same time the OVF trigger other DMA channel to write new PER value. And DMA just copy from table 8 short periods and one long to the PER and then restart itself.

 

Seems doable but need to test and prove it.