4.8 Functions to Support Secondary Core PRAM

The 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 DSC 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:

dsPIC33CH128MP508 Family Data Sheet (DS-70005319), Section 4.3

dsPIC33CH512MP508 Family Data Sheet (DS-70005371), Section 4.3