I try to code on a PIC32MM0256PGM048 on MPLAB but i have a trouble. The code seems to go further on then CLK_init(). I put the code and my CLK Config here.
I keep in the while((OSCCONbits.OSWEN != 0U) || (status == 0U)) during all the running time.
void SYS_Initialize ( void* data )
{
/* MISRAC 2012 deviation block start */
/* MISRA C-2012 Rule 2.2 deviated in this file. Deviation record ID - H3_MISRAC_2012_R_2_2_DR_1 */
/* Start out with interrupts disabled before configuring any modules */
(void)__builtin_disable_interrupts();
CLK_Initialize();
GPIO_Initialize();
UART2_Initialize();
/* MISRAC 2012 deviation block start */
/* Following MISRA-C rules deviated in this block */
/* MISRA C-2012 Rule 11.3 - Deviation record ID - H3_MISRAC_2012_R_11_3_DR_1 */
/* MISRA C-2012 Rule 11.8 - Deviation record ID - H3_MISRAC_2012_R_11_8_DR_1 */
/* MISRAC 2012 deviation block end */
EVIC_Initialize();
/* Enable global interrupts */
(void)__builtin_enable_interrupts();
CLk init :
void CLK_Initialize( void )
{
/* unlock system for clock configuration */
SYSKEY = 0x00000000U;
SYSKEY = 0xAA996655U;
SYSKEY = 0x556699AAU;
/* Even though SPLL is selected in FNOSC, Harmony generates #pragma code as FRCDIV, not as SPLL, in "initilization.c".
* Switching to SPLL is done here after appropriate setting of SPLLCON register.
* This is done to ensure we don't end-up changing PLL setting when it is ON. */
/* Configure SPLL */
/* DIV_1, MUL_3, PLLSRC= FRC */
SPLLCON = 0x10080;
/* Now switch to the PLL source */
OSCCON = OSCCON | 0x00000101U; //NOSC = SPLL, initiate clock switch (OSWEN = 1)
/* Wait for PLL to be ready and clock switching operation to complete */
uint32_t status = CLKSTATbits.SPLLRDY;
status |= CLKSTATbits.SPDIVRDY;
while((OSCCONbits.OSWEN != 0U) || (status == 0U))
{
status = CLKSTATbits.SPLLRDY;
status |= CLKSTATbits.SPDIVRDY;
}
/* Peripheral Module Disable Configuration */
PMD1 = 0x101001U;
PMD2 = 0xf000007U;
PMD3 = 0x1ff00U;
PMD4 = 0x7U;
PMD5 = 0x1070705U;
PMD6 = 0x1U;
PMD7 = 0x0U;
/* Lock system since done with clock configuration */
SYSKEY = 0x33333333U;
}
Someone has an idea ?

