Configuring the dsPIC33CH Master Project

Setting up the Master Project

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.

ConfiguringMasterCore.png

After establsihing these Slave core settings you will need toexport them so they can be shared by the Slave project

Slave Core Selection and Configurations

To select the Slave core for configuration:

  • Create anMPLAB® X IDE project or open an already existing MPLAB X IDE project with the Master device selected from the dsPIC33CH family.
  • LaunchMLPAB® Code Configurator (MCC) by
    • Clicking on the MCC icon in MPLAB X IDE, or
    • Navigating toTools > Embedded > MPLAB Code Configurator v3: Open/Close.
  • Slave Core appears as a module in the Device Resource area of MCC in a Master project.
SettingUpMasterProject1.png
  • Double-click on the Slave Core's instance to add it to the Project Resource area.
SettingUpMasterProject2.png

Configuring the Slave Core

In order to set up the Slave core, configure the following modules.

  • MSI
  • Slave's ICD
  • Slave's Internal Oscillator
  • Slave's Watchdog
SettingUpMasterProject3.png

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.
SettingUpMasterProject4.png

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 selectProgramming Clock (PGC) andProgramming Data (PGD) pins based on the hardware used.

SettingUpMasterProject5.png

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.
SettingUpMasterProject6.png

Configuring Slave Watchdog

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

SettingUpMasterProject7.png

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.

SettingUpMasterProject8.png
SettingUpMasterProject9.png

Naming the Slave Project

The Master core is programmed with both Master and Slave code. 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.

SettingUpMasterProject10.png

 Learn More

 Procedure

Exporting Slave Configuration Data
Configuring the Slave Project

 Step-by-Step

Step-by-Step Example