Arduino Forum

Products => Arduino Due => Topic started by: sandsound on Nov 21, 2012, 04:18 pm

Title: analog inputs
Post by: sandsound on Nov 21, 2012, 04:18 pm
Hi all

The specifications on the SAM3X8E say that the chip have 16 audio analog inputs, is there anyway to access them all on the DUE?

I'm building a midi drumbrain and would like to avoid using multiplexor's.

http://www.sandgreen.dk/index.php/e-drums/arduino-drumtrigger (http://www.sandgreen.dk/index.php/e-drums/arduino-drumtrigger)
Title: Re: Audio inputs
Post by: Grumpy_Mike on Nov 21, 2012, 04:27 pm
You sure about that?
Are you mixing them up with analogue inputs? They are not the same thing.
Title: Re: Audio inputs
Post by: sandsound on Nov 21, 2012, 05:55 pm

You sure about that?
Are you mixing them up with analogue inputs? They are not the same thing.


Sorry bout that, I ment to write analog inputs.
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 21, 2012, 07:53 pm
Well if you look at the data sheet and the schematic you will see that 4 of the analogue inputs are used for other things:-
PA11 - TXdata2
PB12 SDA0 - 3
PB13 SCL0 - 3
PB21 Rx3
That means they are switched to those alternate functions and they are wired up on the board as if they were those functions. So yes if you want to hack the tracks and initialise those as analogue functions you can do, but you then loose the functionality of what they are assigned to at the moment.
Title: Re: analog inputs
Post by: sandsound on Nov 21, 2012, 09:57 pm

... if you want to hack the tracks and initialise those as analogue functions you can do, but you then loose the functionality of what they are assigned to at the moment.


Thanks :-)
I don't use those inputs, and I might be able to hack the hardware, but I'm not sure what to do with the software?
Will I have to change the source to the IDE or can I just use analogRead(0-15)?
Title: Re: analog inputs
Post by: CrossRoads on Nov 21, 2012, 09:58 pm
analogRead(0-15) - the names on the board are just that - names.
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 21, 2012, 10:14 pm
Quote
can I just use analogRead(0-15)?

Probably not.

Quote
Will I have to change the source to the IDE

Probably.

Or you can directly access the hardware and do all the other stuff associated with a read as well.
Title: Re: analog inputs
Post by: sandsound on Nov 21, 2012, 11:08 pm

... Or you can directly access the hardware and do all the other stuff associated with a read as well.


Sorry if I'm asking dumb questions, but does "directly access" imply flashing the chip without the IDE?
If so... I haven't had much luck with this.

Right now I'm using A0-11 for triggers, but I'm not sure about DAC0-1, can I use them just like the other analog inputs?
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 21, 2012, 11:19 pm
Quote
but does "directly access" imply flashing the chip without the IDE?

No.
It means talking directly to the registers on the chip that control the A/D. Just like you do on the Uno when doing things like setting the PWM speed.
Title: Re: analog inputs
Post by: CrossRoads on Nov 22, 2012, 12:33 am
Sorry, my reply was incorrect - I didn't realize this was for the Due chip, I had '2560 on the brain.
Title: Re: analog inputs
Post by: sandsound on Nov 22, 2012, 01:55 am
So if I don't want to modify the IDE and the bord, I only have 10 analog inputs?
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 22, 2012, 07:21 am

So if I don't want to modify the IDE and the bord, I only have 10 analog inputs?

It is twelve isn't it?
Title: Re: analog inputs
Post by: sandsound on Nov 22, 2012, 03:04 pm


So if I don't want to modify the IDE and the bord, I only have 10 analog inputs?

It is twelve isn't it?


If someone could kindly direct me to where I might find these two extra pins I would be delighted.

I know what the documentation says, but I can't see more than 10 analog inputs on the board.
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 22, 2012, 04:11 pm
Quote
but I can't see more than 10 analog inputs on the board.

.?
The board has analogue inputs labeled A0 to A11 that's twelve inputs.
Title: Re: analog inputs
Post by: sandsound on Nov 22, 2012, 04:25 pm
Damn... I need new glasses  :smiley-red:
Title: Re: analog inputs
Post by: Markus_L811 on Nov 22, 2012, 04:40 pm

Quote
but I can't see more than 10 analog inputs on the board.

.?
The board has analogue inputs labeled A0 to A11 that's twelve inputs.


In some way both wrong, there a 14 analog pins the last 2 are on TWI0 but they have Pull-ups
Title: Re: analog inputs
Post by: Grumpy_Mike on Nov 22, 2012, 05:43 pm
Quote
In some way both wrong,

No I said:-
Quote
The board has analogue inputs labeled A0 to A11 that's twelve inputs.

That is in no way incorrect.
The fact that the board has a few more analogue inputs dedicated to an other function was mentioned further back in the thread.

In fact you are wrong saying:-
Quote
there a 14 analog pins

There are in fact 15 analogue pins, the 16th input to the multiplexer is the internal temperature monitor.
But only 12 are supported in the software as used by the digitalRead(pin) function.
Title: Re: analog inputs
Post by: Markus_L811 on Nov 23, 2012, 08:10 am

Quote
In some way both wrong,

No I said:-
Quote
The board has analogue inputs labeled A0 to A11 that's twelve inputs.

That is in no way incorrect.
The fact that the board has a few more analogue inputs dedicated to an other function was mentioned further back in the thread.

In fact you are wrong saying:-
Quote
there a 14 analog pins

There are in fact 15 analogue pins, the 16th input to the multiplexer is the internal temperature monitor.
But only 12 are supported in the software as used by the digitalRead(pin) function.


Yes Mike, you are right I'am wrong, my fault. I missed ADC14 on Pin52, and yes my wrong 12 supported by the corefiles from the IDE. Sorry.