When to use:
When NOT to use:





33CK256MP508Inputs: None (configuration block only)
Outputs: None (configuration block only)
This is the master configuration block that defines target device and system settings. It does not have signal portsβit provides global configuration used by all other MCHP blocks in the model.
| Parameter | Variable | Description | Values/Range |
|---|---|---|---|
| Target | PICREF | Microcontroller selection. Dynamic popup filtered by supported families with oscillator support verification. | 800+ devices (dsPIC, PIC32, SAM) |
| Package | PACKAGE | (SAM only) Package selection for ARM devices (affects pin availability). | TQFP, LQFP, QFN, etc. |
| Parameter | Variable | Description | Values/Range |
|---|---|---|---|
| Oscillator Source | OSCILLATOR_SELECT | Primary oscillator source selection. Options dynamically updated based on chip capabilities. | β’ Internal Fast RC (FRC) | β’ Internal Low Power RC (LPRC) | β’ Crystal/Ceramic Resonator | β’ External Clock (EC) | β’ Device-specific options |
| Crystal Frequency | QUARTZ | Crystal/resonator frequency when using external oscillator. | 0.4 MHz to 40 MHz (device-dependent) |
| Enable PLL | ACTIV_PLL | Enable Phase-Locked Loop for frequency multiplication. | on / off |
| Target MIPS | MIPS_DESIRED | Target instruction cycle frequency (FCY). Automatically calculates PLL settings. | Device-specific | Up to 200 MIPS (dsPIC33A) | Up to 300 MHz (SAME70) |
| Auxiliary Clock | ACLKCON | (dsPIC33C only) Auxiliary clock configuration for PWM and other peripherals. | AFPLLO, FRC, FOSC |
| CPU Divider | CPUDIV | (SAM Cortex-M0+ only) CPU clock divider selection. | 1, 2, 4, 8, 16, 32, 64, 128 |
| Voltage Range | VDD_range | (SAM Cortex-M0+ only) Operating voltage range (affects flash wait states). | 1.62-2.7V, 2.7-3.6V, 3.6-5.5V |
| FRC Tuning | FRC_TUNE_* | Fine-tunes the Fast RC oscillator centre frequency. Visible only when FRC (or FRC-derived PLL) is selected as the oscillator source. Grid and range are chip-dependent (see FRC / BFRC Tuning below). | Per-chip grid, or Custom expression |
| BFRC Tuning | BFRC_TUNE_Range1P5_Step0P047 | Fine-tunes the Backup FRC oscillator (dsPIC33A only). Visible only when BFRC is selected as the oscillator source. | Β±1.5 % grid in 0.047 % steps, or Custom expression |
Select oscillator source (internal RC or external crystal/clock)
If using crystal, specify frequency in QUARTZ parameter
Enable PLL if higher frequencies are required
Set MIPS_DESIRED to target frequency - PLL multipliers are calculated automatically
Block display shows achieved MIPS/MHz on the diagram
Scope β dsPIC33F, dsPIC33E, dsPIC33C (CK / CH) and dsPIC33A only. Ignored on chips without an
OSCTUNregister.
The internal Fast RC oscillator (FRC) and, on dsPIC33A, the Backup FRC (BFRC) can be trimmed at run-time through the OSCTUN register. The Master block exposes this as a popup built from the chip’s datasheet grid, plus a Custom entry that accepts a MATLAB expression evaluated against the base workspace.
| Grid | Range | Step | Applies to |
|---|---|---|---|
Range12_Step0P375 | Β±12 % (β12.000 % β¦ +11.625 %) | 0.375 % | dsPIC33F, dsPIC33E (legacy 6-bit OSCTUN, Arch=3, non-CK/CH) |
Range1P5_Step0P047 | Β±1.5 % (β1.500 % β¦ +1.453 %) | 0.047 % | dsPIC33CK / dsPIC33CH, dsPIC33A (both FRC and BFRC) |
Register encoding β The Master block converts the selected percentage into a signed 6-bit value written to OSCTUN.TUN (FRC) or OSCTUN.BTUN (BFRC, dsPIC33A only):
TUN = round(pct / max_pos Γ 31) β range 0 β¦ +31TUN = βround(|pct| / max_neg Γ 32) β range β32 β¦ β1The conversion is handled by MCHP_Master_OscTuneToRegister. max_pos / max_neg per grid: Range12_Step0P375 β (11.625, 12.0); Range1P5_Step0P047 β (1.45, 1.5).
Custom expression β Selecting Custom in the popup enables a sibling edit field (*_CUSTOM) that accepts any numeric MATLAB expression (including workspace variables). The expression is evaluated at build time, clamped to the grid range, and quantised to the nearest 6-bit step before being written to the register. Use this to pass calibration data loaded from, for example, a factory-test routine:
load('factory_calibration.mat', 'frcTrimPct'); % e.g. +0.235
set_param([mdl '/Master'], 'FRC_TUNE_Range1P5_Step0P047', 'Custom');
set_param([mdl '/Master'], 'FRC_TUNE_Range1P5_Step0P047_CUSTOM', 'frcTrimPct');
When to use β Temperature compensation of FRC-driven clocks, factory trim-to-target, characterising an unknown FRC drift before moving to a crystal, or deriving a calibrated baud-rate from an uncharacterised device.
Limitations β FRC / BFRC tuning does not compensate for long-term drift; for applications that require < 1 % frequency accuracy, use an external crystal or ceramic resonator via the Crystal/Ceramic Resonator oscillator source.
The Master block exposes device-specific configuration fuses extracted from Microchip XML specifications. Available fuses depend on the selected chip.
| Common Fuse Categories | Examples | Description |
|---|---|---|
| Watchdog Timer | FWDTEN, FWDTPS | Watchdog enable and prescaler settings |
| Code Protection | FCPS, FBOR | Read/write protection, boot segment protection |
| Debugging | FICD, FJTAG | ICD/JTAG enable, pin selection |
| Power Management | FBOR, FPOR | Brown-out reset, power-on reset settings |
| Peripheral Config | FIOEN, FBS | Peripheral pin select, boot segment |
On classic 16-bit dsPIC families that have an Alternate Interrupt Vector
Table (dsPIC33C/CK/CH/E/F), the Memory controls let you place the
application’s interrupt vectors in the AIVT β typically so a bootloader owns
the default vector table while the application uses the alternate one. These
controls are hidden on dsPIC33A (which uses a different IVT mechanism) and
on any device without the FSEC.AIVTDIS fuse.
| Parameter | Variable | Description |
|---|---|---|
| Enable Alternate IVT for application image | AIVT_EN | When checked, the generated startup selects the Alternate Interrupt Vector Table (INTCON2bits.AIVTEN = 1) before <model>_initialize(), so interrupts armed during initialization are serviced through the alternate (_AltXxxInterrupt) handlers. |
| Configure boot-segment size | BSLIM_EN | When checked, the boot-segment limit fuse (FBSLIM) is emitted, reserving a boot segment. |
| Boot segment limit (FBSLIM) | BSLIM_VAL | Raw 13-bit FBSLIM fuse value (hex, binary, decimal or a workspace variable). A larger value = a smaller boot segment. The AIVT lives at the start of the last boot-segment page. Range 0x0001..0x1FFE. |
Dependency β the GUI keeps these consistent automatically:
FBSLIM is kept.The friendly checkboxes drive the underlying
AIVTDIS/BSEN/BSLIMconfiguration fuses; the raw fuse popups are hidden to avoid conflicting settings. SetFBSLIMto exactly match the value your bootloader is built with. See the device datasheet (e.g. DS70005320 Β§28 for 33CK) for the boot-segment / AIVT memory map.
| Parameter | Description | Notes |
|---|---|---|
| Master/Slave Selection | For dsPIC33CH dual-core devices, select chip name ending with “S1” for slave core configuration. | β’ Master: 33CH128MP508 |
| SECONDARYIMAGE | Automatically set to slave image name when slave device is selected. | Used by build system to link secondary core code |
| Parameter | Description | Set By |
|---|---|---|
| Compiler Path | Automatically detected compiler installation paths. | Auto-configured from system |
| Header Paths | Include directories for device headers. | Auto-configured from DFP |
| Linker Script | Memory map linker script selection. | Auto-selected or custom |
| Library Paths | Standard library paths (math, DSP, etc.). | Auto-configured |
External Mode is not configured on the Master block. The communication channel is a MCHP UART Config block with its Use this UART for External Mode / PIL option enabled, and the host COM port / baud are chosen from the External Mode configuration panel on the Microchip toolstrip. See the External Mode guide. The Master block only selects the target device and clock that the rest of the model (including that UART) is generated for.
| Parameter | Description | Usage |
|---|---|---|
| BUSYFLAG | Assign a GPIO pin to toggle during task execution for timing analysis. | β’ Not used |
| Family | Examples | Features | Applications |
|---|---|---|---|
| dsPIC30F | 30F1010, 30F2020, 30F6015 | Legacy DSC, basic DSP engine | Motor control, power supplies |
| dsPIC33F | 33FJ128MC802, 33FJ256GP710A | Enhanced DSP, DMA, advanced PWM | Digital power, motor control |
| dsPIC33E | 33EP512MU810, 33EP256MC710 | PPS, DMA, high-speed ADC | Motor control, instrumentation |
| dsPIC33C | 33CK64MC105, 33CH128MP508 | Dual-core options, high-speed PWM | Motor control, power conversion |
| dsPIC33A | (Latest) | 33AK128MC106, 33AK512MPS512 | Advanced PWM with FEP, 12-bit ADC |
| Family | Examples | Features | Applications |
|---|---|---|---|
| PIC32MK | 32MK0512MCF064, 32MK1024GPK100 | MIPS M5150, FPU, motor control | Advanced motor control |
| PIC32MZ | 32MZ2048EFM144, 32MZ2048EFG144 | High-performance MIPS, crypto (EF only) | IoT, connectivity, graphics |
| PIC32A | (New) | 32AK1216GC41036 | Next-gen 32-bit architecture (dsPIC33A core) |
| Family | Core | Examples | Features |
|---|---|---|---|
| SAME70 | Cortex-M7 | SAME70Q21B, SAME70N21B | 300 MHz, FPU, DSP, Ethernet |
| SAMS70 | Cortex-M7 | SAMS70Q21B | High-speed processing, security |
| SAMV71 | Cortex-M7 | SAMV71Q21B | Automotive, CAN-FD, safety |
| SAME5x | Cortex-M4F | SAME54P20A | 120 MHz, crypto, low power |
| SAMC2x | Cortex-M0+ | SAMC21N18A | Motor control, cost-optimized |
| SAMD2x | Cortex-M0+ | SAMD21G18A | Ultra-low power, IoT |
| PIC32CZ | Cortex-M7 | PIC32CZ_MC70 | High-performance, security |
The Master block creates essential variables in the model workspace (accessible to all blocks):
| Variable | Description | Example |
|---|---|---|
| MCHP.id.name | Selected chip reference | ‘33AK128MC106’ |
| MCHP.id.Arch | Architecture ID | 8 (dsPIC33A), 5 (SAM M7) |
| MCHP.fcy.FCY | Instruction cycle frequency (Hz) | 100e6 (100 MIPS) |
| MCHP.fcy.FOSC | Oscillator frequency (Hz) | 200e6 (200 MHz) |
| MCHP.NTIMERS | Number of available timers | 1-12 (device-dependent) |
| MCHP.modsrc.* | Peripheral availability flags | DOS module indicators |
| MCHP.Rx | Pin remapping (PPS) data structure | Available remappable pins |
The Master block automatically configures critical code generation parameters:
RTWSystemTargetFile to appropriate .tlc fileSee the External Mode guide for the full procedure and troubleshooting.
The Master block supports 800+ Microchip microcontrollers across multiple families:
% Add block to model
add_block('MCHP_Blockset/System Configuration/Microchip Master', [mdl '/Master']);
% Configure key parameters
set_param([mdl '/Master'], 'PICREF', '33CK64MC105');
set_param([mdl '/Master'], 'OSCILLATOR_SELECT', 'Internal Fast RC (FRC)');
set_param([mdl '/Master'], 'ACTIV_PLL', 'on');
set_param([mdl '/Master'], 'MIPS_DESIRED', '100e6');
% Select dsPIC33AK128MC106
% Configure for motor control application
PICREF: 33AK128MC106
OSCILLATOR_SELECT: Crystal / Ceramic resonator
QUARTZ: 8e6 % 8 MHz crystal
ACTIV_PLL: on % Enable PLL
MIPS_DESIRED: 100e6 % 100 MIPS target
% Result: FCY = 100 MHz, FOSC = 200 MHz
% PLL automatically configured: M=50, N1=2, N2=2
% Select SAME70Q21B with LQFP package
% High-performance application
PICREF: SAME70Q21B - LQFP144
OSCILLATOR_SELECT: Crystal Oscillator
QUARTZ: 12e6 % 12 MHz crystal
ACTIV_PLL: on % Enable PLL
MIPS_DESIRED: 300e6 % 300 MHz ARM core
% Result: MCLK = 300 MHz
% Master core configuration
% Slave core built separately
PICREF: 33CH128MP508 % Master core
OSCILLATOR_SELECT: Internal Fast RC (FRC)
ACTIV_PLL: on
MIPS_DESIRED: 90e6 % 90 MIPS master
% Slave project uses: 33CH128MP508S1
% Ultra-low power IoT application
PICREF: SAMD21G18A
OSCILLATOR_SELECT: Internal 48MHz Oscillator
ACTIV_PLL: off
CPUDIV: 1 % No division
VDD_range: 2.7V to 3.6V % Standard voltage
% Result: 48 MHz operation
| Problem | Cause | Solution |
|---|---|---|
| Block GUI closes on Apply | Normal behavior when changing devices (fuse structure changes) | Re-open block to see updated configuration |
| Compiler not found | XC16/XC32 not installed or not in PATH | Install compiler from Microchip website, run picSetup |
| Desired MIPS not achievable | PLL limitations or oscillator range | Check datasheet for valid PLL settings, try different crystal |
| Fuses not visible | Device XML not found or old blockset version | Ensure DFP installed, update blockset |
| Code generation fails | Missing DFP or linker script | Check compiler optimization block, verify DFP installation |
The Master block MUST be present before adding any other MCHP blocks
Changing the target device may invalidate peripheral block configurations
Always verify achieved MIPS matches application requirements
Dual-core devices require separate projects for master and slave cores
External mode requires dedicated UART - cannot be shared with application