Maximum Pin Usage on Due (any duplicate/dedicated pins?)

I would like to use the most pins possible on my Due. I have read in a few places that some pins are duplicates?

I cannot read a pin schematic and make heads or tales of it. It says that D10 = D77 and D4 = D87... are those duplicates in the CODE, or on the physical board?

anyway, I'm using Serial over USB.

My question in the most clear way I can put it:
Looking at the board, which physical pins can I use as Digital IO and which ones are duplicates or unavailable because of Serial. I think 0 and 1 are used for serial?

Followup: What about if I (additionally) use the dedicated SPI pins in the middle (for SPI)? What pins are those duplicates of?

Thanks and sorry if this is obvious to some of you. I honestly can't read that schematic and I've been looking at it since November, way before I got the Due.

poodull:
I would like to use the most pins possible on my Due. I have read in a few places that some pins are duplicates?

I cannot read a pin schematic and make heads or tales of it. It says that D10 = D77 and D4 = D87... are those duplicates in the CODE, or on the physical board?

They are physically shared signals on the board. I think they are the only two lines shared in this way. All the other lines are mapped 1:1 with pins on the the SAM3X.

Followup: What about if I (additionally) use the dedicated SPI pins in the middle (for SPI)? What pins are those duplicates of?

You can use MISO, MOSI and SCLK on that connector, and they are not physically shared with other pins.

That is how I read the schematic, I am sure if I am wrong someone will correct me :slight_smile:

Awesome, thanks for the reply. I hope you're right.

About the dedicated SPI pins... is that SPI0, SPI1? All of the example code uses the typical SPI static class and refers to 13 and 11 as MOSI and SCLK.

If I use the middle MOSI and SCLK (all I need for my w2801s), can I use 13 and 11 (or 9 and 50 for that matter) for DIO?

Thanks again for trying to help.

The dedicated SPI is just SPI, I think, there is only one SPI supported by the Due SPI library. The Due pins are numbered D74,D75 and D76 and these are the pins used by SPI lib.

I'm not sure about the SPI-CSx pins, are they used in Master or Slave mode? SPI-CS3 is not mapped anywhere (unconnected on SAM3X), so if you don't want SS/CS then specifying BOARD_SPI_SS3 will ensure the SPI does not interfere with other pins.

BOARD_SPI_SS3 ?

That's interesting. Do you have any sample code or documentation for that? Google comes up blank. Again, sorry if that's obvious but I can't find anything on it.

I am looking at the file ...\arduino-1.5.1r2\hardware\arduino\sam\variants\arduino_due_x\variant.h. This has BOARD_SPI_SS3. On the Due schematic, SS3 is pin 142, PB23, but is not connected to anything.

If you are desperate for IO, there are 4/5 pins on the JTAG connector that could be used.

If you are really desperate for IO, there are several unconnected pins. With some fine wire, decent soldering skills, and good seeing, you could bring them out to an external header.... perhaps not a very robust solution, but a dab of glue could help.

Thanks, I'm not that hard up for pins. And that looks a little outside of my comfort zone. I'm having a hard time understanding the pins that ARE available, let alone creating new ones.

What I'm really confused about is that with the Mega, SPI is pins 11 and 13. And as far as I know there's only one.

Now with the Due, I've got dedicated SPI pins. But every sample code and library is using 11 and 13. And there's also pins 4 and 52? But is there still only one SPI? My Max32 has 4 SPI definitions, so it's confusing me.

Then there's also MOSI2 in the Due pin diagram, which is on the ICSP header. what is that?

I don't want to utilize weird pins. I want to know if I can use physical pins 0~53, A0~A11, DAC0-1, CANRX, CANTX, SCL1 and SDA1 without overlap.

And additionally, if I use USB Serial (just defined as Serial.begin), and SPI (just defined as SPI.begin) will that consume any of these physical pins?

I realize now that I might not be making a lot of sense. reading the arduino reference it seems pretty clear (now) that there is only one SPI in the Due, and it is located on the dedicated SPI pins.

I think that pins 13 and 11 are for older Arduinos or for Software SPI (SoftSPI?) that are really just bit-banging? I might be wrong there, but I think, at least, that SPI is it's own set of pins (going to ignore the ICSP header and MOSI2 for now) and there is no conflict with the outer pins.

So how about those other weird pins? CANRX/TX, DAC0/1, SCL1/SDA1? Can those be used for Digital IO?