Go Down

Topic: ADC on the Arduino Due (Read 224 times) previous topic - next topic

OmerFlame

Hey everyone!

I recently bought an Arduino Due, thinking it has 16 analog inputs (that's what the official Arduino page says, at least), and when I tried to compile a project that uses A15, it failed. What am I doing wrong here? The site clearly says 16 inputs...!

PieterP

It seems like the last 4 ADC pins aren't labeled as A12-A15, instead, they are the DAC0/1 and CAN RX/TX pins:

Pieter

OmerFlame

Should I try to analogRead() from the DAC? Sounds a little stupid... lol

PieterP

Looking at the datasheet, it looks like the official pinout is wrong.
The other ADC inputs are pins 20, 21 and 52. The 16th ADC channel is connected to an internal temperature sensor, not an actual pin, so the "16 analog input pins" on the product page is incorrect as well.

MarkT

From what I can gather the official Due's, both v1 and v2 pin out only 12 ADC lines.

The chips for both have 16 channels, and some 3rd-party boards like the Seeed one
bring them all out.

The silk-screening on the boards is definitive.  That pinout diagram is bogus.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

PieterP

From what I can gather the official Due's, both v1 and v2 pin out only 12 ADC lines.
If the schematic is to be believed, it brings out all 15 ADC lines, AD8/AD9 are connected to pins 20/21 (PB12/PB13, SDA0-3/SCL0-3) and A14 is connected to pin 52 (PB21, RXD3).

From the SAM3X datasheet ยง43.4, p.1319:
Quote
Note 1. AD15 is not an actual pin but is connected to a temperature sensor.
Either way, both the pinout diagram and the technical specs on the product page are wrong. Any idea where to report this?

ard_newbie

The DUE Core (arduino DUE 100% compatible board) has all Sam3x pins broken out:

DUE CORE

Note that since ADC channel 15 is the internal temperature sensor, it remains 15 ADC channels (ADC ch0 to ADC ch 14) for your own inputs.

The most relevant pinout diagram is the one provided by Graynomad. You will find this pinout in the DUE sub forum.

OmerFlame

Looking at the datasheet, it looks like the official pinout is wrong.
The other ADC inputs are pins 20, 21 and 52. The 16th ADC channel is connected to an internal temperature sensor, not an actual pin, so the "16 analog input pins" on the product page is incorrect as well.

So how do I analogRead() from them? This very moment I tried to write
Code: [Select]
analogRead(20) and it didn't do anything....

(deleted)


OmerFlame

Of course, I did something with it. I used the reading as a parameter for another function to display it on a SPI display using Ucglib made by olikraus.

(deleted)

#10
Jul 13, 2020, 03:11 pm Last Edit: Jul 13, 2020, 03:14 pm by smarts-jb
(deleted)

OmerFlame

I have a huge project with multiple files, it's gonna be pretty hard to follow everything... but I worked really hard on this and I think I can count on myself to do SOMETHING with the reading, unless I'm just extremely dumb...

OmerFlame

Also,I tried to just print it to the serial monitor and it says "0" all the time. Something is wrong here.

(deleted)


OmerFlame

Is there anything I can do to make it work?

Go Up