Xmega ADC free running mode by default ?

Vincent31
Benutzer
Avatar
Gender: n/a
Posts: 30
Registered: 07 / 2008
Subject:

Xmega ADC free running mode by default ?

 · 
Posted: 28.04.2015 - 15:52  ·  #1
Hello all,

I use ADC of XMEGA32E and I have the feeling it's running in free running mode, because I use multiplexers 74HC4051 and data is late N-1 channel...
How to disconnect the free running mode ? and start conversation only when ADC data is required.

Thanks, Vincent
Harald_K
 
Avatar
 
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 28.04.2015 - 21:04  ·  #2
normally, the ADC is served in the SYSTICK interrupt. mutiple input channels are internally switched, the respective port pins / directions will be set automatically.

you can create your own muxing by using the onADCread-procedure.

there, you will get the result of the last conversion, and on exit of this procedure, the system starts the ADC again leaving a result at the next SYSTICK interrupt.

the SYSTICK-time must be long enough to allow conversion of the ADC to complete, so select the appropriate prescaler.
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2134
Registered: 03 / 2003
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 28.04.2015 - 21:48  ·  #3
Hallo Harald,

wenn ich den Systick auf (extrem) 0.1 stellen würde, schafft das ein Mega @ 12 MHz ?

Gruss
Harry
Harald_K
 
Avatar
 
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 28.04.2015 - 22:14  ·  #4
also ein 16MHz mega128 kann bei nem 0,2ms Systick noch sauber wandeln.

kommt aber auch auf den prescaler an ... der mega-ADC braucht sowas um 15 Clockzyklen für sampling und Wandlung - der ADC kann bis 200 kHz oder so (Datenblatt gucken) - da kann ein 12er Quarz schneller sein als ein 16er, weil beim 16er nur ein div128 geht, beim 12er aber ein div64 langen kann.
Vincent31
Benutzer
Avatar
Gender: n/a
Posts: 30
Registered: 07 / 2008
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 29.04.2015 - 08:42  ·  #5
Hello Harald,

Thanks for this information, I understand the procedure, but using the systick, even to 1ms is really too slow as I have 88 ADC lines to convert, and maximum time is 5 µs each conversation, in fact I must use the max speed of Xmega ADC...
So my question, is it possible to read ADC directly with AVRco without using systick interrupt ? or may be the only way to program read operation at high speed is to use ADC registers directly ?

Thanks for your help !
Harald_K
 
Avatar
 
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 29.04.2015 - 13:04  ·  #6
in this case, you cannot use the avrco functions.
programming of the ADC is not so difficult, and the multiplexing you still have programmed, so the rest is just accessing one or two registers.

but the free running mode is not suitable, cause you do not know if the ADC is just in a conversion when you switch the input, so you will not be able to say if the result is from the selected input or from the previous ...

so ... select input ... start ADC .. wait til ready ... read result & store

maybe you use the ADCs conversion-complete-interrupt to do all things, cause this will keep the CPU free for your application during conversion time.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 29.04.2015 - 13:34  ·  #7
Hello Vincent,

all said by Haraldt is correct.
The AVRco ADC driver is not sufficient and applicable for high speed conversions.
It is intended to build a useful measurement without a user intervention. So it
is slow because it is based on the SysTick.
Fast and very fast scanning must be done by the user itself.

rolf
Vincent31
Benutzer
Avatar
Gender: n/a
Posts: 30
Registered: 07 / 2008
Subject:

Re: Xmega ADC free running mode by default ?

 · 
Posted: 29.04.2015 - 15:13  ·  #8
Hello Harald and Rolf,

Ok I see, and thanks for suggestions, so I have to use registers directly now...

Vincent
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 8 · Cache Hits: 14   138   152 · Page-Gen-Time: 0.020647s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI