dsPIC33A Hardware Configuration

Last modified by Microchip on 2025/02/12 16:55

Overview

Software needs hardware!

Before you can develop firmware with dsPIC33A in MPLAB® X IDE, you need to develop a functional hardware schematic and understand some basic hardware configuration defaults, so your firmware can successfully execute on the target.

basic hardware config overview

This page reviews the required dsPIC33A basic pin connections, and where to locate this information in the device datasheet. We’ll also review the clock system default configuration, and other hardware defaults and how to set configuration bits in C-code to change these default hardware settings.

Required Pin Connections

VDD/VSS & AVDD/AVSS

All VDD/VSS pins must be properly biased with the required supply voltages. This includes the AVDD/AVSS pins, even if no analog functionality is used in your application.

basic hardware config vdd vss pins

Decoupling capacitors are recommended for use on every pair of VDD/VSS and AVDD/AVSS pins. Refer to the datasheet for details on the recommended values.

Back to Top

MCLR

The MCLR pin is used to perform a device reset and is also used in programming/debug operations.

basic hardware config mclr pin

A pull-up connection to the reset or MCLR (Master Clear) pin is required to keep the device in a normal (non-reset) state. This can be as simple as a 4.7k to 10k pullup resistor from the MCLR pin to VDD but the recommended option is to use an RC circuit (10k and 0.1 uf) from VDD to ground with a small value series resistor (100 to 470 ohm) from the center of the RC connection to the MCLR pin. This will give a slower rise time on the MCLR pin and allow more time for VDD to stabilize.

The series resistor limits current flow into the MCLR in the event of an internal MCLR pin breakdown.

Back to Top

PGC/PGD

Programming and debugging connections, also known as the ICSP (In-Circuit Serial Programming) connections are only required for firmware development and not the operation of the device.

basic hardware config icsp pins

There are five connections required to connect the Programmer/Debugger tool (such as a PICkit™ 5) to the device. These five connections include:

  • The VDD and VSS pins
  • The MCLR pin
  • Plus the ICSP pins: PGC (Clock) and PGD (Data).

Optionally, you can also connect the dsPIC33A serial Universal Asynchronous Receiver Transmitter (UART) TX and RX pins to the PICkit 5 pin header, since this debugger additionally enumerates a USB CDC connection so serial data can be exchanged between the dsPIC® device and a Terminal application running on the PC.

Back to Top

Clock System Configuration

The dsPIC33A clock system supplies clocking to the CPU and peripherals. The module is based on a number of clock generators (CLKGENs) and PLL generators (PLLGENs). The CLKGENs are preassigned to the CPU and peripherals. Each clock generator selects a clock source from the available oscillators or PLLs and passes it to a selectable divider circuit. CLKGEN1 provides the CPU and Peripheral Clocks.

basic hardware config clocks

Default Configuration

On reset, CLKGEN1 is enabled with the 8 MHz FRC oscillator source. This provides an 8 MHz clock for the CPU, and  8, 4, and 2 MHz clocks for the Fast, Standard, and Slow peripheral clocks respectively after reset.

Information

Unlike previous dsPIC33 devices, the dsPIC33AK uses Special Function Registers (SFRs) to control clock functions instead of configuration bits!

For more details, visit the dsPIC33A Clock System page.

Back to Top

Configuration Bits

It is unlikely that a new C program will run properly on the device, even though the program is valid.

All Microchip microcontrollers must be configured to ensure correct hardware operation. Some device configuration settings affect the fundamental operation of the device, such as those controlling the instruction clock. The configurable hardware options are in the datasheet chapter titled “Configuration Bits.”

basic hardware config configuration bits datasheet

To configure the device, the programmer must use a series of #pragma config configuration options as shown here:

basic hardware config configuration bits pragma

Information

It is recommended to explicitly set all configuration options in your source code and not rely on default settings.

MPLAB X IDE provides a graphical view to configure and then generate the complete list of #pragma statements which you can copy/paste into your source code:

basic hardware configuration bits MPLAB X IDE view

Back to Top