Arduino Due

The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU, making it the first Arduino board based on a 32-bit ARM core microcontroller. This powerful and versatile board is designed for projects that require higher computational power or more input/output flexibility than the typical 8-bit boards like the Arduino Uno. It is perfect for advanced robotics, audio projects, and complex computations.

Key Specifications
Feature Description
MicrocontrollerAtmel SAM3X8E ARM Cortex-M3
Operating Voltage3.3V
Input Voltage (recommended)7-12V
Input Voltage (limits)6-20V
Digital I/O Pins54 (of which 12 provide PWM output)
Analog Input Pins12
Analog Output Pins2 (DAC)
Total DC Output Current on all I/O lines130 mA
Flash Memory512 KB
SRAM96 KB (two banks: 64KB and 32KB)
Clock Speed84 MHz
Unique Features
Programming the Arduino Due

The Arduino Due can be programmed using the Arduino IDE, just like other Arduino boards. It supports the standard Arduino programming language but takes advantage of its faster processor and larger memory for more complex applications. To upload your code, you can use the Programming port (connected via the ATmega16U2 chip) or the Native USB port.

Pin Layout

The Arduino Due has a total of 54 digital I/O pins, of which 12 can be used as PWM outputs. The board also features 12 analog inputs and 2 analog outputs for DAC. Additionally, it has SPI, I2C, and UART communication capabilities through designated pins.

Arduino Due

Arduino Due front/top view (ARM Cortex-M3 SAM3X8E based board)

Image: see Wikimedia Commons page above — check the file page for author & license (often 'own work' by Arduino or CC BY-SA).

Warnings

Please note that the Arduino Due operates at 3.3V. Applying more than 3.3V to the input/output pins could damage the board.

Applications
Conclusion

The Arduino Due is a powerful platform for users who need more computational power and I/O flexibility than the standard Arduino boards can provide. With its 32-bit ARM Cortex-M3 core, high-speed clock, and extensive I/O pins, it is ideal for advanced users looking to push their projects to the next level.

Arduino Due ADC Overview

The Arduino Due has a 12-bit ADC that converts analog voltages (0–3.3V) into digital values (0–4095). It is suitable for sensor readings, voltage measurements, and other analog input tasks.

Key Features of Arduino Due ADC
  • 12-bit resolution (0–4095)
  • 12 analog input channels (A0–A11)
  • Default ADC clock: 1 MHz (adjustable up to 20 MHz maximum; actual conversion rate depends on clock and number of channels)
  • Practical conversion rates:
    • 12-bit: ~800 kSPS (thousand samples per second) using single channel
    • 10-bit: up to ~1.5 MSPS possible
    • 8-bit: up to ~2.5 MSPS possible
  • DMA support for high-speed continuous sampling
  • Input voltage range: 0–3.3V
  • Optional reduction of resolution (10-bit or 8-bit) can increase maximum sampling speed
Standard ADC Method

Use analogRead() to read analog values from a pin. Returns 0–4095 corresponding to 0–3.3V.


// Standard ADC Example for Arduino Due
int analogPin = A0;
int adcValue = 0;

void setup() {
    Serial.begin(115200);
}

void loop() {
    adcValue = analogRead(analogPin);
    Serial.println(adcValue);
    delay(100);
}
        
  • analogRead(pin): Reads voltage on the pin and converts to digital value
  • Printed to Serial Monitor; simple but slower for frequent readings
DMA ADC Method

For high-speed continuous sampling, DMA transfers ADC data directly to memory without CPU intervention.


// DMA-based ADC Example for Arduino Due
#include <DueDMA.h>
#include <ADC.h>

ADC adc;
DueDMA dma;
volatile uint16_t adcBuffer[256];

void setup() {
    Serial.begin(115200);
    adc.setResolution(12);
    adc.setSamplesAverage(1);
    adc.start(ADC_FREQ_MAX);
    dma.allocateChannel(DueDMA::ADC, &adcBuffer, 256);
    dma.enable();
}

void loop() {
    if (dma.isFinished()) {
        for (int i = 0; i < 256; i++) {
            Serial.println(adcBuffer[i]);
        }
        dma.start();
    }
}
        
  • DMA enables continuous high-speed ADC sampling
  • dma.allocateChannel(): sets memory buffer for ADC results
  • dma.isFinished(): checks transfer completion
When to Use Standard vs DMA ADC
  • Standard ADC: Occasional analog readings
  • DMA ADC: Continuous high-speed data acquisition, e.g., audio or logging
Conclusion

Arduino Due’s 12-bit ADC provides both simple and high-speed sampling methods. Standard ADC is suitable for basic applications, while DMA allows continuous, CPU-efficient high-speed data acquisition.

I2C Overview on Arduino Due

I2C is a serial communication protocol that allows you to connect multiple devices using only two wires: SDA (data) and SCL (clock). The Arduino Due supports I2C communication, making it easy to interface with a wide range of sensors, EEPROMs, and displays.

Key Features
  • Two-wire communication: SDA (Data) and SCL (Clock)
  • Supports multiple devices on the same bus
  • Default I2C frequency is 100 kHz (can be increased up to 400 kHz)
Usage Example

#include <Wire.h>

void setup() {
  Wire.begin();  // Initialize I2C as master
  Serial.begin(115200);
}

void loop() {
  Wire.beginTransmission(0x68);  // Address of device
  Wire.write(0x00);               // Send data
  Wire.endTransmission();
  delay(1000);
}
        
SPI (Serial Peripheral Interface) on Arduino Due

The Arduino Due uses the SPI protocol to communicate with external devices such as sensors, displays, and memory chips. SPI allows for fast data transfer between the microcontroller and peripherals.

Key Features
  • Supports SPI modes 0, 1, 2, and 3
  • High-speed data transfer up to 10 MHz (or higher depending on clock configuration)
  • Multiple slave devices can be connected using chip select pins
Usage Example

#include <SPI.h>

void setup() {
  Serial.begin(115200);
  SPI.begin();  // Initialize SPI
  pinMode(SS, OUTPUT);
}

void loop() {
  digitalWrite(SS, LOW);
  SPI.transfer(0x01);  // Send a byte
  digitalWrite(SS, HIGH);
  delay(1000);
}
        
TIMER on Arduino Due

The Arduino Due offers multiple timers for PWM, delays, and time-based events. These timers are part of the SAM3X8E microcontroller’s advanced hardware.

Key Features
  • 3 timers: Timer 0, Timer 1, Timer 2
  • Configurable for PWM, interrupts, and delays
  • Timer frequency based on system clock (84 MHz)
Usage Example

void setup() {
  Timer1.initialize(1000000);  // Trigger every 1 second
  Timer1.attachInterrupt(timerIsr);  // Attach ISR
}

void loop() {}

void timerIsr() {
  Serial.println("Timer triggered");
}
        
PWM Output at 25kHz

Using TC0, Ch0 to generate 25kHz PWM on pin 2 (TIOA0). Main clock 84 MHz, divided by 2 (TIMER_CLOCK1), RC=1680, RA sets duty cycle.


void setup() {
  pmc_set_writeprotect(false);
  pmc_enable_periph_clk(ID_TC0);

  TC_Configure(TC0, 0,
    TC_CMR_TCCLKS_TIMER_CLOCK1 |
    TC_CMR_WAVE |
    TC_CMR_WAVSEL_UP_RC |
    TC_CMR_ACPA_SET | TC_CMR_ACPC_CLEAR);

  TC_SetRC(TC0, 0, 1680);
  TC_SetRA(TC0, 0, 840);

  PIOB->PIO_PDR |= PIO_PB25;
  PIOB->PIO_ABSR |= PIO_PB25;

  TC_Start(TC0, 0);
}

void loop() {}
        
Frequency Counter

Measure frequency using TC1 Ch0 (TIOA3 = PC2). Rising edge capture calculates frequency.


volatile uint32_t last_capture = 0;
volatile uint32_t frequency = 0;

void setup() {
  Serial.begin(115200);
  pmc_enable_periph_clk(ID_TC3);
  
  TC_Configure(TC1, 0,
    TC_CMR_TCCLKS_TIMER_CLOCK1 |
    TC_CMR_ETRGEDG_RISING | TC_CMR_ABETRG |
    TC_CMR_LDRA_RISING | TC_CMR_CPCTRG);

  TC1->TC_CHANNEL[0].TC_IER = TC_IER_LDRAS;
  NVIC_EnableIRQ(TC3_IRQn);

  TC_Start(TC1, 0);
}

void TC3_Handler() {
  uint32_t now = TC1->TC_CHANNEL[0].TC_RA;
  frequency = 42000000 / (now - last_capture);
  last_capture = now;
}

void loop() {
  Serial.println(frequency);
  delay(500);
}
        
Pulse Width Measurement

Captures high and low time on TIOA3 using input capture.


volatile uint32_t rise_time = 0, fall_time = 0;
volatile uint32_t high_time = 0;

void setup() {
  Serial.begin(115200);
  pmc_enable_periph_clk(ID_TC3);

  TC_Configure(TC1, 0,
    TC_CMR_TCCLKS_TIMER_CLOCK1 |
    TC_CMR_ABETRG |
    TC_CMR_LDRA_RISING |
    TC_CMR_LDRB_FALLING);

  TC1->TC_CHANNEL[0].TC_IER = TC_IER_LDRBS;
  NVIC_EnableIRQ(TC3_IRQn);
  TC_Start(TC1, 0);
}

void TC3_Handler() {
  rise_time = TC1->TC_CHANNEL[0].TC_RA;
  fall_time = TC1->TC_CHANNEL[0].TC_RB;
  high_time = fall_time - rise_time;
}

void loop() {
  Serial.print("High Time (us): ");
  Serial.println((high_time * 1000000UL) / 42000000);
  delay(500);
}
        
Quadrature Encoder

TC0 Ch0 configured in quadrature mode. Reads encoder position using TIOA0/TIOB0 (pins 2 & 13).


void setup() {
  Serial.begin(115200);
  pmc_enable_periph_clk(ID_TC0);

  TC_Configure(TC0, 0, TC_CMR_TCCLKS_TIMER_CLOCK1);
  TC0->TC_BMR = TC_BMR_QDEN |
                TC_BMR_POSEN |
                TC_BMR_EDGPHA |
                TC_BMR_MAXFILT(1);

  TC_Start(TC0, 0);
}

void loop() {
  int32_t position = TC0->TC_CHANNEL[0].TC_CV;
  Serial.print("Encoder Count: ");
  Serial.println(position);
  delay(100);
}
        
SERIAL Communication on Arduino Due

Arduino Due features multiple hardware serial ports (USART) that allow communication with other devices such as computers, sensors, and displays. The Due has four UARTs (Serial0 to Serial3).

Key Features
  • Supports four hardware serial ports
  • Baud rates up to 1 Mbps
  • Full-duplex communication
Usage Example

void setup() {
  Serial.begin(115200);  // Initialize Serial Monitor
  Serial1.begin(115200); // Initialize another serial port
}

void loop() {
  if (Serial1.available()) {
    char received = Serial1.read();
    Serial.println(received);  // Print received data
  }
}
        
Interrupts on Arduino Due

Interrupts allow the Arduino Due to respond immediately to certain events or inputs, such as a pin change or timer overflow. Useful for tasks requiring high responsiveness, like sensor data processing, external event handling, or hardware control.

Key Features
  • Supports external interrupts on pins 2–13
  • Can trigger on rising, falling, or change
  • Supports timer and peripheral interrupts
  • Handled in real-time, enabling non-blocking programs
Usage Example

volatile int interruptCounter = 0;

void setup() {
  Serial.begin(115200);
  pinMode(2, INPUT);
  attachInterrupt(digitalPinToInterrupt(2), countInterrupts, FALLING);
}

void loop() {
  Serial.println(interruptCounter);
  delay(1000);
}

void countInterrupts() {
  interruptCounter++;
}
        
Configuration

Interrupts can be configured using attachInterrupt(), which attaches an interrupt to a pin and sets the triggering condition (falling, rising, or change). The ISR (Interrupt Service Routine) executes when the interrupt occurs.

Types of Interrupts
  • External Interrupts: Triggered by voltage changes on specific pins (e.g., buttons or sensors).
  • Timer Interrupts: Generated at regular intervals for time-critical tasks.
  • Pin Change Interrupts: Arduino Due handles interrupts on pins 2–13 for fast response to external signals.
Limitations
  • ISRs should be short to avoid blocking other interrupts
  • Avoid using delay() inside interrupts
  • Careful management needed when using interrupts with other peripherals
Arduino Due RTC (Real-Time Clock) Overview

The Arduino Due is based on the SAM3X8E ARM Cortex-M3 microcontroller, which includes an internal RTC peripheral. However, the Due board does not provide a dedicated 32.768 kHz crystal or battery backup, so the RTC cannot maintain time across power cycles by default.

While powered, the internal RTC can track time and generate alarms or interrupts, which is useful for scheduling tasks during runtime or low-power sleep periods.

For applications requiring accurate, persistent timekeeping, you have two main options:

  • External RTC Modules: I²C or SPI modules like DS3231 or PCF8523 provide battery-backed, high-accuracy timekeeping that persists across power loss.
  • Alternative Microcontrollers: Devices such as the ESP32 include a built-in RTC subsystem with low-power sleep support and, optionally, backup power, making them suitable for projects where RTC is a system requirement.
Arduino Due USB Ports

The Arduino Due features two USB ports: the Programming Port and the Native USB Port. The Native USB Port can also support USB OTG functionality.

USB Programming Port

Used primarily for uploading sketches and serial communication. It uses the ATmega16U2 as a USB-to-serial converter.

  • Upload sketches to the board
  • Acts as USB-to-Serial converter
  • Supports Serial Monitor communication
USB Native Port

Connected directly to the ATSAM3X8E microcontroller. Supports USB device mode, USB OTG, HID, Mass Storage, or Serial communication.

  • Acts as USB device (keyboard, mouse, etc.)
  • Supports USB OTG for host communication
  • Uses built-in USB peripheral of ATSAM3X8E
  • Supports USB Serial and other protocols
Using Native USB Port as USB Device (Client)
  1. Connect Native USB Port to host (PC or USB OTG device)
  2. Use USBHost library or implement device functionality
  3. Specify device type (USB Serial, HID, Mass Storage)
  4. Upload sketch and test communication
Example: USB Serial Device

void setup() {
    Serial.begin(115200);
}

void loop() {
    if (Serial.available()) {
        char incomingByte = Serial.read();
        Serial.print("Received: ");
        Serial.println(incomingByte);
    }
}
        
Example: USB Keyboard

#include <Keyboard.h>

void setup() {
  Keyboard.begin();
  delay(2000);
  Keyboard.print("Hello from Arduino Due Keyboard!");
  Keyboard.end();
}

void loop() {}
        
Example: USB Mouse

#include <Mouse.h>

void setup() {
  Mouse.begin();
}

void loop() {
  Mouse.move(10, 0);
  delay(100);
  Mouse.move(-10, 0);
  delay(100);
}
        
Example: Keyboard + Mouse

#include <Keyboard.h>
#include <Mouse.h>

void setup() {
  Keyboard.begin();
  Mouse.begin();
  delay(2000);
  Keyboard.print("Keyboard and Mouse started.");
  Mouse.move(20, 0);
  delay(500);
  Mouse.move(-20, 0);
  Keyboard.end();
  Mouse.end();
}

void loop() {}
        
Example: USB Host Keyboard

#include <USBHost.h>

USBHost usb;
KeyboardController keyboard(usb);

void setup() {
  Serial.begin(115200);
  while (!Serial);
  Serial.println("Waiting for keyboard...");
  keyboard.attachPress(onKeyDown);
  keyboard.attachRelease(onKeyUp);
}

void loop() {
  usb.Task();
}

void onKeyDown(uint8_t keycode) {
  Serial.print("Key Pressed: ");
  Serial.println(keycode);
}

void onKeyUp(uint8_t keycode) {
  Serial.print("Key Released: ");
  Serial.println(keycode);
}
        
Conclusion

Arduino Due's USB ports provide versatile options: the Programming Port is ideal for sketch upload and serial communication, while the Native USB Port supports USB OTG, device emulation, and host communication with a variety of peripherals.

CAN Overview on Arduino Due

The Arduino Due features a built-in CAN bus interface, which is widely used in automotive and industrial applications for communication between microcontrollers and devices such as sensors, actuators, and controllers.

Key Features
  • Supports CAN 2.0 A/B protocols
  • Built-in CAN controller (using the SAM3X8E's hardware support)
  • Allows communication at up to 1 Mbps
Usage Example

#include <SPI.h>
#include <mcp_can.h>

MCP_CAN CAN(10);  // Initialize CAN on pin 10

void setup() {
  Serial.begin(115200);
  if (CAN.begin(CAN_500KBPS)) {
    Serial.println("CAN Bus Initialized");
  }
}

void loop() {
  CAN.sendMsgBuf(0x100, 0, 8, data);  // Send CAN message
  delay(1000);
}
        
Arduino Due DAC Overview

The Arduino Due includes two true analog output pins: DAC0 and DAC1. These pins provide 12-bit analog voltages from 0 to 3.3V (not PWM), useful for audio, waveform generation, and analog signal output.

Basic Example – Sine Wave Output using analogWrite()

Output a sine wave on DAC0 using precomputed values with analogWrite():


const int sineTable[60] = {2048, 2251, 2452, 2649, /* ... */ 2419};

void setup() {
  analogWriteResolution(12); // 12-bit DAC
}

void loop() {
  for (int i = 0; i < 60; i++) {
    analogWrite(DAC0, sineTable[i]);
    delayMicroseconds(500); // ~3.3 kHz
  }
}
        
Advanced Example – DAC with DMA & Timer Trigger

Configure the DAC to be triggered by Timer Counter 0 (TC0) and transfer a waveform using DMA for smooth, continuous output with minimal CPU usage.


#define WAVE_SAMPLES 100
uint16_t sine_wave[WAVE_SAMPLES];

void setupWaveform() {
  for (int i = 0; i < WAVE_SAMPLES; i++) {
    sine_wave[i] = 2048 + 2047 * sin(2 * PI * i / WAVE_SAMPLES);
  }
}

void setup() {
  analogWriteResolution(12);
  setupWaveform();

  pmc_enable_periph_clk(ID_DACC);
  dacc_reset(DACC);
  dacc_set_transfer_mode(DACC, 0);
  dacc_set_timing(DACC, 0x08, 0, 0);
  dacc_set_channel_selection(DACC, 0);
  dacc_enable_channel(DACC, 0);
  dacc_set_trigger(DACC, 1); // external trigger

  pmc_set_writeprotect(false);
  pmc_enable_periph_clk(ID_TC2);
  TC_Configure(TC0, 2,
    TC_CMR_TCCLKS_TIMER_CLOCK1 | TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC);
  TC_SetRC(TC0, 2, 42000);
  TC_Start(TC0, 2);

  DACC->DACC_PTCR = DACC_PTCR_TXTEN;
  DACC->DACC_TPR  = (uint32_t)sine_wave;
  DACC->DACC_TCR  = WAVE_SAMPLES;
  DACC->DACC_TNPR = (uint32_t)sine_wave;
  DACC->DACC_TNCR = WAVE_SAMPLES;
  DACC->DACC_PTCR = DACC_PTCR_TXTEN;

  DACC->DACC_MR |= DACC_MR_TRGEN_EN | DACC_MR_TRGSEL(0);
}

void loop() {
  // CPU-free waveform output via DMA
}
        

DMA-driven DAC output allows smooth, continuous waveforms with minimal CPU load, ideal for high-frequency analog signal generation.

Arduino Due RTC (Real-Time Clock) Overview

The Arduino Due is based on the SAM3X8E ARM Cortex-M3 microcontroller, which includes an internal RTC peripheral. However, the Due board does not provide a dedicated 32.768 kHz crystal or battery backup, so the RTC cannot maintain time across power cycles by default.

While powered, the internal RTC can track time and generate alarms or interrupts, which is useful for scheduling tasks during runtime or low-power sleep periods.

For applications requiring accurate, persistent timekeeping, you have two main options:

  • External RTC Modules: I²C or SPI modules like DS3231 or PCF8523 provide battery-backed, high-accuracy timekeeping that persists across power loss.
  • Alternative Microcontrollers: Devices such as the ESP32 include a built-in RTC subsystem with low-power sleep support and, optionally, backup power, making them suitable for projects where RTC is a system requirement.
Arduino Due – Legal & Trademark Notice

Arduino® is a registered trademark of Arduino AG. SAM3X / SAM3A (ATSAM3X8E) is a microcontroller by Microchip Technology Inc. (formerly Atmel®). Visit Arduino website. Visit ATSAM3X8E product page | Download SAM3X / SAM3A series datasheet (PDF).

© 2025 Arduino AG & Microchip Technology Inc. All rights reserved.

Arduino Boards & Modules

Official boards (Uno, Due, Mega) and kits. Ideal for hobbyists, educators, and professionals.