12 channel interrupt based ADC for atmega32u4 processor

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

Dear Experts,

Hi,

for a project I need to get all 12 ADC channels of an ATMEGA32U4 based board to work concurrently.

But I would like to know following answers :

1. what is the maximum frequency sampling for each channel? ( suppose input clock of board is 16MHz).

2. Is there any interrupt based open source code that i can use?

 

 

BR

Mehrdad,

 

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

The 32u4 has a single channel ADC with a multiplexer in front of it.  you cannot sample all the channels at the same time.

 

The datasheet has all the sampling information

 

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

You get an a/d reading every 100usec or so, so 12 of them will take 1200usecs. What rate do you need?

 

Imagecraft compiler user

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

Hi again,

and thanks for the answer,

Dear Jim,

 

By concurrent I mean I would like to make all 12 channels work.

I get one sample from first channel and one sample from second channel and ... and loop it again.

 

Dear Bob,

I need maximum speed of 1000 samples per second for each channel now. ( for ECG project).

 

But could some body give me a hint how to develop intterupt based 12 channel ADC program?

BR

Mehrdad,

 

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

What is the source of the interrupt?  The ADC upon completion of a conversion?

 

Code would be simple enough.

Set up a counter to count from 0 to 0x0b(11)

mux channel = count

 

Set up the ADC for interrupt on conversion complete

 

Start the conversion

 

Sit in a loop until interrrupt fires

 

When interrupt fires save the result from the ADC in SRAM

Increment count

mux = count

start ADC

return

 

 

I did not include anything for noise reduction etc.  my example is crude to say the least.  Do a search in the forums.  There is something there.

 

Jim

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I need maximum speed of 1000 samples per second for each channel now. ( for ECG project).

Should be do-able. For max 10bit resolution the ADCs can do a maximum of 15,300 conversions per second. You look like you need 12,000 per second.

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

Once you get these 12000 samples each second (using 10% to 20% of processor), where are you going to put them on an AVR8?  How much processing is needed and how often?  As you mentioned a USB-enabled AVR model, I'd guess you plan to send stuff out via the USB.  Lessee-- I guess that I'd put all 12 samples into a packet, 25 bytes plus overhead.  Isn't USB once-a-millisecond?  So it would "just work" if you >>never<< were too busy on the other end to swallow a packet?
 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Should be do-able. For max 10bit resolution the ADCs can do a maximum of 15,300 conversions per second. You look like you need 12,000 per second.

From previous work and discussions here, each channel had better have very good "drive" to avoid cross-channel effects.

 

Now, I'm not an expert Xmega user, but round-robin conversions and DMA buffers and inbuilt USB sounds like it was made for this.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Thanks again for answers,

I think for every channel we could get more than 15000 samples per second not for all the channels.

But as I work on LUFA project, I would rather find some peace of code for interrupt based ADC conversion to put inside it.

I dont know how to define interrupt routines for LUFA project uder linux avr compiler yet .

Now I am going to surf the web to find some thing useful.

 

BR

Mehrdad,