Functions to Support Secondary Core PRAM

These utility functions program the Secondary core with the specified image which has been generated by an MPLAB X IDE project. These functions will not work unless using the XC16 model of programming. Outside of this paradigm, refer to the device programming specification.

Examples of Use

Example 1: Secondary PRAM Load and Verify Routine

#include <libpic30.h>
//wipe memory before programming
_wipe_secondary(&secondary_image)

//_program_secondary(core#, verify, &secondary_image)
if (_program_secondary(l, 0, &secondary_image) == 0)
{
  /* now verify */
  if (_program_secondary(l, 1, &secondary_image) == ESEC_VERIFY_FAIL)
  {
    asm(“reset”) ; // try again
  }
}

Example 2: Secondary Core Start and Stop

#include <libpic30.h>
int main()
{
  // Main intialization code
  _start_secondary(); // Start Secondary core

  // Main application code
  _stop_secondary(); // Stop Secondary core

  while(1);
}

Reference Documents:

ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH128MP508-Family-Data-Sheet-DS70005319D.pdf (See Section 4.3)

ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Data-Sheet-DS70005371D.pdf (See Section 4.3)