Configuring the dsPIC33CH Master Project in MPLAB® Code Configurator (MCC) Classic
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.
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.
- Double-click on the Slave Core's instance to add it to the Project Resources area.
Configuring the Slave Core
To set up the Slave Core, configure the following modules.
- MSI
- SLAVE ICD
- SLAVE INTERNAL OSCILLATOR
- SLAVE WATCHDOG
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.
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.
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 Source | This 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 Postscaler | This 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 Enable | The control allows you to select the PLL as the clock source for the Slave core. |
Clock output pin configuration | This allows you to configure the OSC2 pin as either clock output or general-purpose digital IO in the Slave core. |
Enable Clock Switching | This allows you to enable the clock-switching feature. |
Enable Fail-Safe | This 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. |
Configuring Slave Watchdog
These settings allow you to configure the Slave core's watchdog timer:
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.
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.