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.
After establsihing 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 MLPAB® Code Configurator (MCC) by
- Clicking on the MCC icon in MPLAB X IDE, or
- Navigating to Tools > Embedded > MPLAB Code Configurator v3: Open/Close.
- Slave Core appears as a module in the Device Resource area of MCC in a Master project.
- Double-click on the Slave Core's instance to add it to the Project Resource area.
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
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 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.
Learn More
Procedure
Exporting Slave Configuration Data
Configuring the Slave Project