Home References AVR64DB32 Hardware Quick Reference

AVR64DB32 Hardware Quick Reference

AVR References

Device Overview

The AVR64DB32 is a 32-pin, 8-bit AVR microcontroller from Microchip’s AVR DB family. It combines 64 KB of Flash, 8 KB of SRAM, 512 bytes of EEPROM, a 12-bit ADC, a 10-bit DAC, two integrated operational amplifiers and Multi-Voltage I/O (MVIO).

The device is intended for embedded control, mixed-signal measurement, analogue signal conditioning and applications requiring communication between different digital voltage domains.

It uses the modern AVR peripheral architecture, including PORTMUX routing, an Event System, Configurable Custom Logic and single-pin UPDI programming.

Parameter AVR64DB32 specification
Manufacturer Microchip Technology
Family AVR DB
CPU 8-bit AVR with hardware multiplier
Maximum CPU frequency 24 MHz
Program Flash 64 KB
SRAM 8 KB
EEPROM 512 bytes
User row 32 bytes
Package pin count 32
Package types VQFN-32, TQFP-32
General-purpose I/O 26 input-capable, 25 output-capable
Main supply VDD
Separate I/O supply VDDIO2
Programming/debug interface UPDI
Operating voltage 1.8–5.5 V, subject to operating conditions
Analogue-to-digital converter 12-bit differential ADC
Digital-to-analogue converter 10-bit DAC
Operational amplifiers 2
Analogue comparators 3
Zero-cross detectors 1
Hardware USARTs 3
SPI controllers 2
TWI/I2C controllers 2
16-bit TCA timers 1
16-bit TCB timers 3
12-bit TCD timer 1
Real-Time Counter 1
Event System channels 8
Configurable Logic LUTs 4

The maximum clock frequency is not necessarily available across the complete operating-voltage and temperature range. Consult the device’s frequency-versus-voltage specifications before selecting the final clock.

32-Pin Package Pinout

The following pin assignments apply to the AVR64DB32 32-pin VQFN and TQFP packages. Package drawings must be used to establish physical orientation and pin-one location.

Pin Signal Principal function or restriction
1 PA3 GPIO, USART0, TWI0, timer output
2 PA4 GPIO, USART0 alternate, SPI0 MOSI
3 PA5 GPIO, USART0 alternate, SPI0 MISO
4 PA6 GPIO, USART0 alternate, SPI0 SCK
5 PA7 GPIO, SPI0 SS, clock output
6 PC0 MVIO GPIO, USART1 TX, SPI1 MOSI
7 PC1 MVIO GPIO, USART1 RX, SPI1 MISO
8 PC2 MVIO GPIO, SPI1 SCK, alternate TWI0 SDA
9 PC3 MVIO GPIO, SPI1 SS, alternate TWI0 SCL
10 VDDIO2 Secondary I/O supply
11 PD1 GPIO, ADC AIN1, OP0 positive input
12 PD2 GPIO, ADC AIN2, OP0 output
13 PD3 GPIO, ADC AIN3, OP0 negative input
14 PD4 GPIO, ADC AIN4, OP1 positive input
15 PD5 GPIO, ADC AIN5, OP1 output
16 PD6 GPIO, ADC AIN6, DAC output
17 PD7 GPIO, ADC AIN7, OP1 negative input, VREFA
18 AVDD Analogue supply connection
19 AGND Analogue ground
20 PF0 GPIO, ADC AIN16, USART2 TX, 32 kHz crystal
21 PF1 GPIO, ADC AIN17, USART2 RX, 32 kHz crystal
22 PF2 GPIO, ADC AIN18, TWI1 SDA
23 PF3 GPIO, ADC AIN19, TWI1 SCL
24 PF4 GPIO, ADC AIN20, alternate USART2 TX
25 PF5 GPIO, ADC AIN21, alternate USART2 RX
26 PF6 RESET, input-only functionality
27 UPDI Programming and debugging
28 VDD Main digital supply
29 GND Digital ground
30 PA0 GPIO, USART0 TX, high-frequency crystal
31 PA1 GPIO, USART0 RX, high-frequency crystal
32 PA2 GPIO, USART0 clock, TWI0 SDA

Pin numbers are physical package pin numbers, not Arduino digital pin numbers.

A development board may introduce its own connector numbering or pin aliases.

The listed peripheral assignments are selected functions. Several signals support alternative routes through PORTMUX, and not every function on a pin can operate simultaneously.

GPIO Port Organisation

The AVR64DB32 exposes signals from Ports A, C, D and F.

Port Available signals Notes
PORTA PA0–PA7 Eight general-purpose signals
PORTC PC0–PC3 Four MVIO signals
PORTD PD1–PD7 Seven analogue-capable GPIO
PORTF PF0–PF6 Six ordinary I/O plus input-only PF6
UPDI Dedicated UPDI Programming and debugging

There is no PORTB or PORTE GPIO bank on the 32-pin device.

GPIO Register Reference

Register Function
PORTx.DIR Direction configuration
PORTx.DIRSET Set direction bits
PORTx.DIRCLR Clear direction bits
PORTx.DIRTGL Toggle direction bits
PORTx.OUT Output latch
PORTx.OUTSET Set output bits
PORTx.OUTCLR Clear output bits
PORTx.OUTTGL Toggle output bits
PORTx.IN Read input levels
PORTx.PINnCTRL Per-pin configuration
PORTx.INTFLAGS Port interrupt flags
VPORTx.DIR Virtual-port direction register
VPORTx.OUT Virtual-port output register
VPORTx.IN Virtual-port input register

The x represents A, C, D or F.

Digital Output Example

This complete XC8 AVR C example toggles PA4, physical pin 2.

#include <avr/io.h>

int main(void)
{
    PORTA.OUTCLR = PIN4_bm;
    PORTA.DIRSET = PIN4_bm;

    while (1)
    {
        PORTA.OUTTGL = PIN4_bm;

        for (volatile uint32_t i = 0; i < 50000UL; i++)
        {
            ;
        }
    }
}

The delay loop is not calibrated and depends on CPU frequency, compiler optimisation and generated instructions.

PA4 must not be simultaneously allocated to a peripheral output.

Input with Pull-Up

PORTA.DIRCLR = PIN4_bm;

PORTA.PIN4CTRL |= PORT_PULLUPEN_bm;

if (PORTA.IN & PIN4_bm)
{
    // PA4 is HIGH.
}

The internal pull-up is suitable for some digital inputs but must not be assumed to provide a precise resistance value.

Input Interrupt Configuration

The modern AVR PORT peripheral supports pin-sense configuration.

PORTA.PIN4CTRL =
    PORT_PULLUPEN_bm |
    PORT_ISC_FALLING_gc;

This selects an internal pull-up and falling-edge detection on PA4.

An application using the interrupt must also provide the appropriate port interrupt service routine and clear the relevant interrupt flag.

Multi-Voltage I/O

The AVR64DB32 includes a separate VDDIO2 supply domain for PC0–PC3.

MVIO allows those pins to operate at a different logic voltage from the main microcontroller I/O domain.

MVIO Supply Organisation

Supply Associated circuitry
VDD Main microcontroller supply
AVDD Analogue circuitry; internally connected to VDD
VDDIO2 PORTC secondary I/O domain
GND Digital ground
AGND Analogue ground

AVDD and VDD are internally connected, but the external analogue supply and ground connections still require suitable PCB routing and decoupling.

Example Supply Arrangement

Supply Example voltage
VDD 5.0 V
VDDIO2 3.3 V
PORTA logic Main supply domain
PORTC logic Secondary supply domain

This illustrates a mixed-voltage design, not a universal guarantee that every supply combination is permissible.

The actual supply limits and relationships must satisfy the MVIO electrical characteristics.

MVIO Configuration

MVIO operation depends on the device’s configuration fuses.

The device supports single-supply and dual-supply arrangements.

In single-supply operation, the secondary domain is not treated as an independently powered logic interface.

In dual-supply operation, VDDIO2 provides the voltage reference for the PORTC I/O circuitry.

Do not leave VDDIO2 floating or assume that its supply requirements can be ignored when MVIO is unused.

The secondary supply’s state can be monitored through the device’s MVIO-related status functionality.

MVIO Design Notes

  • PC0–PC3 belong to the VDDIO2 domain.
  • USART1 and SPI1 signals can use PORTC.
  • TWI0 has alternative signals on PC2 and PC3.
  • External pull-ups must be connected to the appropriate voltage domain.
  • Power sequencing and supply-loss behaviour require consideration.
  • The selected fuse configuration must match the intended circuit.

Clock System

The AVR64DB32 includes internal oscillators and support for external clock sources.

The Clock Controller selects the system clock and applies prescaling where required.

Clock Sources

Source Purpose
Internal high-frequency oscillator Main system clock
Internal 32.768 kHz oscillator Low-frequency timing
External high-frequency crystal/clock Alternative system clock
External 32.768 kHz crystal Accurate low-frequency reference
PLL Clock generation where configured

Clock Connections

Signal Pin Function
PA0 30 High-frequency crystal input
PA1 31 High-frequency crystal connection
PF0 20 32.768 kHz crystal
PF1 21 32.768 kHz crystal

Using an external crystal consumes the corresponding GPIO functions.

Main Clock Registers

Register Function
CLKCTRL.MCLKCTRLA Main clock source selection
CLKCTRL.MCLKCTRLB Main clock prescaler
CLKCTRL.MCLKSTATUS Clock status
CLKCTRL.OSCHFCTRLA Internal high-frequency oscillator
CLKCTRL.XOSCHFCTRLA External high-frequency oscillator control

Clock source switching and oscillator configuration must follow the documented synchronisation and protection requirements.

The device’s maximum 24 MHz CPU speed should not be confused with the default clock selected after reset.

Analogue-to-Digital Converter

The AVR64DB32 contains one 12-bit ADC with support for single-ended and differential measurements.

The 32-pin package provides 13 externally accessible ADC input channels.

ADC Input Matrix

ADC channel GPIO Physical pin
AIN1 PD1 11
AIN2 PD2 12
AIN3 PD3 13
AIN4 PD4 14
AIN5 PD5 15
AIN6 PD6 16
AIN7 PD7 17
AIN16 PF0 20
AIN17 PF1 21
AIN18 PF2 22
AIN19 PF3 23
AIN20 PF4 24
AIN21 PF5 25

AIN0 is not bonded out on the 32-pin AVR64DB32.

Not every analogue channel supports every role in differential operation. In particular, AIN16–AIN21 cannot serve as negative ADC inputs in differential measurements.

ADC Registers

Register Purpose
ADC0.CTRLA ADC enable and operating configuration
ADC0.CTRLB Accumulation settings
ADC0.CTRLC Clock and reference-related configuration
ADC0.MUXPOS Positive input selection
ADC0.MUXNEG Negative input selection
ADC0.COMMAND Conversion commands
ADC0.INTFLAGS Conversion status flags
ADC0.RES Conversion result

Register layouts and options must be checked against the installed device header and datasheet revision.

ADC Resolution

The ideal 12-bit resolution is:

2^12 = 4096 codes

For a simple unipolar conversion with a reference of 4.096 V:

Nominal code width = 4.096 V / 4096
                   = 1 mV

This calculation describes theoretical quantisation, not total ADC accuracy.

Reference error, input impedance, noise, offset, conversion timing and source settling all affect practical measurements.

ADC Input Considerations

  • Select a valid positive input.
  • Select the correct negative input for differential measurements.
  • Configure the reference source.
  • Provide sufficient acquisition time.
  • Account for source impedance.
  • Disable conflicting digital functions where appropriate.
  • Check the permitted input voltage and common-mode range.
  • Apply calibration and averaging only where useful.

The AVR64DB32 does not contain the integrated ADC programmable gain amplifier found in the AVR EA family.

For analogue amplification, it provides two separate operational amplifiers.

Integrated Operational Amplifiers

The AVR64DB32 contains two operational amplifier peripherals.

These can perform analogue signal-conditioning functions without requiring a separate external operational amplifier IC in suitable applications.

Operational Amplifier Pin Reference

Function GPIO Physical pin
OP0 positive input PD1 11
OP0 output PD2 12
OP0 negative input PD3 13
OP1 positive input PD4 14
OP1 output PD5 15
OP1 negative input PD7 17

Op Amp Applications

Configuration Typical use
Voltage follower Sensor buffering
Non-inverting amplifier Signal gain
Inverting amplifier Signal conditioning
Internal feedback configurations Supported analogue gain arrangements
Cascaded stages Multi-stage conditioning

The exact configuration options and available internal connections depend on the OPAMP peripheral.

Non-Inverting Gain

For a conventional non-inverting amplifier with suitable feedback resistors:

Voltage gain = 1 + (Rf / Rg)

Where:

  • Rf is the feedback resistance.
  • Rg is the resistance from the inverting input to the reference node.

With:

Rf = 30 kΩ
Rg = 10 kΩ

the nominal closed-loop gain is:

Gain = 1 + (30 / 10)
     = 4

This is a general op amp calculation. It does not imply that every gain is available using the AVR64DB32’s internal resistor arrangements.

The permitted input common-mode voltage, output swing, gain-bandwidth behaviour, settling time and load-driving capability must be checked.

An integrated op amp is not automatically suitable for signals extending beyond the supply rails.

DAC and Analogue Comparators

Digital-to-Analogue Converter

The AVR64DB32 includes one 10-bit DAC.

Parameter Description
Peripheral DAC0
Resolution 10-bit
Output DAC0 OUT
Physical output PD6, pin 16
Reference Configurable through supported reference sources

The nominal number of DAC codes is:

2^10 = 1024

The DAC is useful for reference generation, analogue thresholds and low-frequency control signals.

Actual output range, drive capability and settling characteristics depend on the analogue specifications.

Analogue Comparators

The device includes three analogue comparators:

  • AC0
  • AC1
  • AC2

Comparators can generate interrupts, peripheral events and selected routed outputs.

Typical uses include voltage threshold detection, analogue fault monitoring and simple signal qualification.

Zero-Cross Detector

The AVR64DB32 also includes one Zero-Cross Detector (ZCD).

Its external input is associated with PD1.

The ZCD is intended for supported zero-cross detection applications and should not be confused with a general-purpose voltage comparator.

Input conditioning and electrical limits are particularly important when monitoring signals originating from external power circuitry.

Do not connect mains voltage directly to the microcontroller.

USART, SPI and TWI Interfaces

Serial Peripheral Counts

Peripheral Instances
USART USART0, USART1, USART2
SPI SPI0, SPI1
TWI TWI0, TWI1

The available routes are determined by the package pinout and PORTMUX configuration.

USART Pin Assignments

USART Signal Default GPIO Physical pin
USART0 TXD PA0 30
USART0 RXD PA1 31
USART0 XCK PA2 32
USART0 XDIR PA3 1
USART1 TXD PC0 6
USART1 RXD PC1 7
USART1 XCK PC2 8
USART1 XDIR PC3 9
USART2 TXD PF0 20
USART2 RXD PF1 21
USART2 XCK PF2 22
USART2 XDIR PF3 23

USART0 and USART2 have alternative assignments supported by the device’s pin multiplexing.

USART1 resides on the MVIO-associated PORTC pins.

The voltage levels of USART1 must therefore be considered together with the VDDIO2 configuration.

SPI Pin Assignments

SPI Signal GPIO Physical pin
SPI0 MOSI PA4 2
SPI0 MISO PA5 3
SPI0 SCK PA6 4
SPI0 SS PA7 5
SPI1 MOSI PC0 6
SPI1 MISO PC1 7
SPI1 SCK PC2 8
SPI1 SS PC3 9

SPI1 uses the MVIO domain.

The device supports peripheral routing options, but software must configure the appropriate PORTMUX selections.

TWI/I2C Pin Assignments

Interface Signal GPIO Physical pin
TWI0 SDA PA2 32
TWI0 SCL PA3 1
TWI1 SDA PF2 22
TWI1 SCL PF3 23

TWI0 also provides alternative SDA and SCL routing through PC2 and PC3.

The TWI peripheral supports host and client operation. Electrical pull-up requirements, voltage levels and bus capacitance must comply with the selected I2C operating mode.

Timer and PWM Resources

The AVR64DB32 provides several timer architectures.

Peripheral Count Primary functions
TCA 1 General timing and PWM
TCB 3 Timing, counting and capture
TCD 1 Advanced waveform generation
RTC 1 Low-frequency timing

TCA

TCA0 is a 16-bit timer supporting waveform generation and other timing functions.

It can operate in normal or split modes.

The actual output pin depends on PORTMUX routing.

TCB

The device contains:

  • TCB0
  • TCB1
  • TCB2

TCB peripherals are useful for interval timing, event counting, pulse measurement and capture operations.

TCD

TCD0 is a 12-bit timer designed for specialised waveform generation.

Its functions can be useful in motor control and power-conversion applications.

TCD configuration is more specialised than basic timer toggling.

Waveform outputs must be checked against pin routing and fault-handling requirements.

Basic Timer Calculation

For a timer incrementing at a known timer-clock frequency:

Timer tick period = Prescaler / Timer clock

For a timer clock of 16 MHz with a prescaler of 64:

Tick period = 64 / 16,000,000
            = 4 µs

The calculation assumes the selected timer supports that prescaler and uses the stated input clock.

Event System and Configurable Custom Logic

Event System

The AVR64DB32 provides eight Event System channels.

EVSYS routes selected peripheral events directly between hardware blocks.

This can reduce CPU intervention for tasks such as:

  • Triggering ADC conversions from timers.
  • Counting external events.
  • Routing comparator events.
  • Synchronising supported peripheral actions.

The available generator and user combinations are device-specific.

Configurable Custom Logic

The device provides four CCL lookup tables.

CCL can implement selected combinational logic functions using peripheral signals or I/O inputs.

Typical applications include:

  • Signal qualification.
  • Hardware gating.
  • Simple digital logic.
  • Combining peripheral event signals.
  • Producing selected logic outputs without continuous CPU processing.

The CCL output routing is subject to the physical pin multiplexing and the chosen configuration.

UPDI Programming and Debugging

The AVR64DB32 uses the Unified Program and Debug Interface.

Parameter Description
Programming interface UPDI
Physical connection Pin 27
Interface type Single-wire programming/debug
Supported development environment MPLAB X IDE
Common compiler MPLAB XC8
Debugging Supported through compatible debugger
Target device selection AVR64DB32

Basic UPDI Connections

Target signal Programmer connection
UPDI UPDI data
GND Common ground
VDD Target voltage reference, as required by programmer

The target must have a correctly configured power supply.

A programming tool should not be assumed to power the target unless that capability is explicitly supported and enabled.

UPDI Precautions

  • Keep the UPDI signal accessible during development.
  • Avoid excessive loading on the programming pin.
  • Confirm the debugger supports the selected target voltage.
  • Select AVR64DB32 rather than a related DB device.
  • Check device-pack compatibility.
  • Be cautious when changing configuration fuses.
  • Preserve a known programming recovery method before altering reset or programming-related settings.

Memory Organisation and Non-Volatile Storage

Memory Reference

Memory Capacity Typical contents
Flash 64 KB Firmware and program constants
SRAM 8 KB Variables, stack and buffers
EEPROM 512 bytes Persistent application settings
User row 32 bytes Application-defined non-volatile information

The Flash and EEPROM are managed through the device’s non-volatile memory controller.

Common NVM Considerations

  • Observe programming and erase requirements.
  • Avoid excessive repeated writes to the same location.
  • Verify data before relying on it.
  • Plan for interrupted writes.
  • Consider wear levelling where write frequency is high.
  • Do not confuse EEPROM capacity with Flash capacity.

Configuration records should contain sufficient information to detect invalid or incompatible data.

For critical settings, consider version fields, checksums and recovery defaults.

Power Supply and Hardware Design

The AVR64DB32 requires suitable supply connections and local decoupling.

Supply Pin Reference

Pin Signal Function
10 VDDIO2 Secondary PORTC supply
18 AVDD Analogue supply
19 AGND Analogue ground
28 VDD Main supply
29 GND Main ground

The power arrangement must follow the device’s electrical characteristics.

Hardware Design Considerations

Decoupling: Place suitable ceramic capacitors close to supply pins, with short return paths.

Analogue routing: Keep sensitive analogue traces away from high-current switching signals and fast digital outputs where practical.

MVIO: Confirm the intended supply mode before connecting a second voltage domain.

Reset: Provide the required reset behaviour and avoid unwanted loading on PF6.

Programming: Reserve access to UPDI.

Oscillators: Follow the specified PCB layout and component requirements when using external crystals.

I/O loading: Check output current limitations and total port-current restrictions before driving LEDs, relays or other loads.

Inductive loads: Use appropriate transistor drivers and suppression components. Do not drive motors or relay coils directly from GPIO.

Operating Frequency Versus Supply Voltage

Do not assume the maximum 24 MHz CPU clock is permitted at the minimum 1.8 V operating supply.

The allowable frequency is determined by the device’s operating-voltage and temperature specifications.

A valid power design must satisfy all three conditions simultaneously.

Common Hardware and Firmware Problems

Symptom Likely cause Corrective action
Device cannot be programmed UPDI connection or tool issue Check pin 27 and debugger
No GPIO output Incorrect port or pin Check package mapping
PA0/PA1 unavailable External oscillator selected Review clock configuration
PORTC does not operate VDDIO2 or MVIO configuration Check secondary supply
USART1 voltage incorrect MVIO domain mismatch Verify VDDIO2
SPI1 communication fails PORTMUX or voltage mismatch Check routing and MVIO
ADC channel unavailable Wrong channel or package assumption Use device-specific input table
ADC readings unstable Reference, acquisition or noise Inspect analogue circuit
Op amp output saturates Input/output range violation Check analogue limits
DAC output incorrect Wrong reference or pin function Check DAC configuration
PWM missing Incorrect timer routing Verify PORTMUX
Unexpected reset Brown-out, watchdog or reset source Read reset flags
Clock frequency incorrect Prescaler or oscillator configuration Inspect CLKCTRL
EEPROM settings corrupted Interrupted write or storage handling Add integrity checks
Firmware exceeds Flash Program too large Check linker memory report
SRAM exhaustion Stack or buffer usage Review memory allocation
I2C does not communicate Missing pull-ups or wrong voltage Check bus electrical design
Timer interval incorrect Wrong timer clock or prescaler Recalculate timing

AVR64DB32 Hardware Quick Reference

Requirement AVR64DB32 resource
CPU 8-bit AVR, up to 24 MHz
Program memory 64 KB Flash
Data memory 8 KB SRAM
Non-volatile settings 512-byte EEPROM
General GPIO PA0–PA7, PC0–PC3, PD1–PD7, PF0–PF6
Input-only GPIO PF6
UPDI Physical pin 27
Main power VDD, pin 28
Main ground GND, pin 29
MVIO supply VDDIO2, pin 10
MVIO pins PC0–PC3
Analogue input PD1–PD7, PF0–PF5
Op amp 0 PD1, PD2, PD3
Op amp 1 PD4, PD5, PD7
DAC output PD6
USART0 PA0–PA3
USART1 PC0–PC3
USART2 PF0–PF3
SPI0 PA4–PA7
SPI1 PC0–PC3
TWI0 PA2/PA3
TWI1 PF2/PF3
TCA TCA0
TCB TCB0–TCB2
TCD TCD0
RTC One
Event channels Eight
CCL LUTs Four
Analogue comparators Three
Zero-cross detectors One

AVR64DB32 Engineering Checklist

  • Confirm the exact AVR64DB32 package and ordering code.
  • Use the 32-pin pinout rather than a larger AVR DB family pinout.
  • Distinguish physical pin numbers from GPIO names.
  • Check the selected clock against operating voltage.
  • Configure the required main clock and prescaler.
  • Verify VDD, AVDD, VDDIO2 and ground connections.
  • Configure MVIO consistently with the hardware supply arrangement.
  • Reserve UPDI access during development.
  • Check PORTMUX before assigning peripherals.
  • Avoid using the same physical pin for conflicting functions.
  • Confirm USART, SPI and TWI routing against the device pinout.
  • Remember that SPI1 and USART1 use MVIO-associated pins.
  • Check ADC input availability and differential-input restrictions.
  • Use suitable ADC acquisition and reference settings.
  • Check op amp common-mode, gain and output limits.
  • Verify DAC output requirements before connecting external circuitry.
  • Calculate timer periods from the actual timer clock.
  • Check TCA, TCB and TCD capabilities independently.
  • Use EVSYS and CCL where hardware event processing is beneficial.
  • Verify EEPROM and Flash programming requirements.
  • Use appropriate decoupling and analogue PCB layout.
  • Do not drive inductive or high-current loads directly from GPIO.
  • Check reset behaviour and brown-out configuration.
  • Use the correct MPLAB device pack and compiler target.
  • Test firmware, peripheral routing and analogue performance on the actual hardware.

You may also like