Configuring the dsPIC33CH Master Project in MPLAB® Code Configurator (MCC) Classic

Last modified by Microchip on 2024/04/10 14:27

Setting up the Master core involves selecting the Slave core and configuring it. The following sections explain the steps involved in setting up the Master core.

Flow diagram of steps involved in setting up the Master core

After establishing these Slave Core settings you will need to export them so they can be shared by the Slave project

Slave Core Selection and Configurations

To select the Slave core for configuration:

  • Create an MPLAB® X IDE project or open an already existing MPLAB X IDE project with the Master device selected from the dsPIC33CH family.
  • Launch MPLAB Code Configurator (MCC) by:
    • Clicking on the MCC icon in MPLAB X IDE, or,
    • Navigating to Tools > Embedded > MPLAB Code Configurator v5: Open/Close.
  • SLAVE CORE appears as a module in the Device Resources area of MCC in a Master project.

Slave core in the Device Resources area

  • Double-click on the Slave Core's instance to add it to the Project Resources area.

Slave core added to Project Resources

Back to Top

Configuring the Slave Core

To set up the Slave Core, configure the following modules.

  • MSI
  • SLAVE ICD
  • SLAVE INTERNAL OSCILLATOR
  • SLAVE WATCHDOG

Slave core settings

Back to Top

Configuring MSI

The MSI is the data gateway between the Master Core and the Slave Core, each of which operates within independent clock domains. The MSI module is primarily intended to move data between the cores.

The Mailbox Configuration table provided in MCC allows you to:

  • Configure handshake protocols by selecting the buffer size. Based on the selected buffer size, MCC allocates a set of mailbox registers to the specific protocol.
  • Define the direction of data flow, whether from M → S (Master to Slave) or S → M (Slave to Master).
  • Optionally, assign a custom name to each protocol. This custom name is used as part of API signatures for the protocol in the generated MCC code.

MSI Mailbox Configuration

Back to Top

Configuring Slave In-Circuit Debugging (ICD)

These settings in MCC allow you to select pins used for in-circuit debugging of the Slave core. You must select Programming Clock (PGC) and Programming Data (PGD) pins based on the hardware used.

Slave core ICD pin settings

Back to Top

Configuring Slave Internal Oscillator

These settings in MCC allow you to configure the required Clock Source, FRC Postscaler, PLL, Clock Switching, and Fail-Safe Monitor for the Slave core.

Clock SourceThis allows you to select the required clock source such as FRC Oscillator, Primary Oscillator, External Clock, LPRC Oscillator, Secondary Oscillator, and Digitally Controlled Oscillator depending on the application. The clock source options may vary with the device used.
Enable FRC PostscalerThis allows you to enable the FRC clock divider for the Slave core and is available only when FRC is selected as the clock source.
PLL EnableThe control allows you to select the PLL as the clock source for the Slave core.
Clock output pin configurationThis allows you to configure the OSC2 pin as either clock output or general-purpose digital IO in the Slave core.
Enable Clock SwitchingThis allows you to enable the clock-switching feature.
Enable Fail-SafeThis allows you to enable or disable the fail-safe monitor feature. When enabled, the fail-safe monitor allows the device to continue to operate even in the event of an oscillator failure.

Slave core oscillator settings

Back to Top

Configuring Slave Watchdog

These settings allow you to configure the Slave core's watchdog timer:

Slave core watchdog timer settings

Back to Top

Assigning Pin Ownership to the Slave Core

Master and Slave cores share the IO ports on the device. The input feature is available to both the cores, whereas the output feature is decided as per the ownership fuses. By default, the output ownership of a pin resides with the Master core. If the Slave core needs the output ownership of a particular pin, the ownership configurations have to be changed. Both the Master and the Slave core(s) can monitor a pin as an input as long as the monitoring is of the same type—digital or analog.
The output ownership can be modified in the Pin Manager: Grid View or the register view under System Module.

The following figures illustrate an example pin assignment procedure.

Locking output pin ownership using the Pin Manager: Grid View

Locking output pin ownership using the System Module: Register View

Back to Top

Naming the Slave Project

The Master Core is programmed with both Master and Slave codes. It is required to include the Slave project image header as a part of the Master code. During execution, the Master Core is initialized first, and the Master core transfers the Slave code onto the slave PRAM.

MCC expects the Slave core project name to be mentioned in the UI. You need to provide the Slave core's MPLAB X IDE project name in the text box. The Slave core's MPLAB X IDE project name provided is used to include a Slave project image header in the Master project generated code.

The Slave project name you entered for the Master project in MCC should exactly match the Slave project created. If you fail to do so, the generated code may not compile.

Naming the Slave Project

Back to Top

Learn More

Procedure

Step-by-Step

Back to Top