Unallocated pins on Arduino IDE

Hi Guys,

I recently designed an Arduino Due based PCB which uses the SAM3X8E and im trying to program it with the Arduino IDE.

Everything works except for one of the pins which i connected to PB1 (pin 93)

It seems the original arduino Due does not use pin 93 as an I/O port and im having difficulty using it.

I've tried a blink sketch to that pin and it uploads but nothing happens on the pin

Any idea of how i can utilise this pin/port without having wasted the PCB?

I think you edit the file called "ArduinoPins.h" in the IDE application folder. I have to admit, I haven't tried. But if you find it and look, you might find some clues.

I've modified that file for '2560 chips.

For the AVRs, there are several tables that all got entries made to add extra port into, extra pin info, PWM (or not) info), and them mappings for something at the top of the file.

In .../variants/due/variant.* is a big array:

extern const PinDescription g_APinDescription[]=
{
  // 0 .. 53 - Digital pins
  // ----------------------
  // 0/1 - UART (Serial)
  { PIOA, PIO_PA8A_URXD,     ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT,  PIN_ATTR_DIGITAL,                 NO_ADC, NO_ADC, NOT_ON_PWM,  NOT_ON_TIMER }, // URXD
  { PIOA, PIO_PA9A_UTXD,     ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT,  PIN_ATTR_DIGITAL,                 NO_ADC, NO_ADC, NOT_ON_PWM,  NOT_ON_TIMER }, // UTXD

  // 2
  { PIOB, PIO_PB25B_TIOA0,   ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM,  TC0_CHA0     }, // TIOA0
  { PIOC, PIO_PC28B_TIOA7,   ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM,  TC2_CHA7     }, // TIOA7
  { PIOC, PIO_PC26B_TIOB6,   ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM,  TC2_CHB6     }, // TIOB6
 :

Add entries for your newly implemented pin(s).
Perhaps be careful about the "group" pins for entries greater than PINS_COUNT
(It doesn't look like anything error-checks against PINS_COUNT, and the array currently goes up to pin 91, so if all you want to do is GPIO, you can probably pretty much add the new pin to the end.)

Isaac258:
Everything works except for one of the pins which i connected to PB1 (pin 93)
It seems the original arduino Due does not use pin 93 as an I/O port and im having difficulty using it.

Are you sure PB1 is pin 93? The Arduino DUE schematic shows PB1 on pin 114. It also shows it as "ETX_EN" so they may not have wanted a conflict between that special function and another I/O pin.

Pin 93 is shown as PC11 and is not connected on the DUE schematic.