AnsweredAssumed Answered

SPC56EL60 using FMPLL as system clock

Question asked by Patrik Schantl on Aug 27, 2014
Latest reply on Sep 2, 2014 by Patrik Schantl
Hello,

I tried to use the FMPLL as system clock, but I get a behaviour which I did not expect. As software basis, I used the test application for the SPC56xL discovery board. When I understand the clock configuration in the right way, this project runs with the 16MHz internal RC. I found the configuration in the file hal_lld.h, all modes are using the internal RC for example here:

/**
* @brief DRUN mode settings.
*/
#if !defined(SPC5_ME_DRUN_MC_BITS) || defined(__DOXYGEN__)
#define SPC5_ME_DRUN_MC_BITS (SPC5_ME_MC_SYSCLK_IRC | \
SPC5_ME_MC_IRCON | \
SPC5_ME_MC_XOSC0ON | \
SPC5_ME_MC_PLL0ON | \
SPC5_ME_MC_PLL1ON | \
SPC5_ME_MC_FLAON_NORMAL | \
SPC5_ME_MC_MVRON)
#endif

/**
* @brief RUN0 mode settings.
*/
#if !defined(SPC5_ME_RUN0_MC_BITS) || defined(__DOXYGEN__)
#define SPC5_ME_RUN0_MC_BITS (SPC5_ME_MC_SYSCLK_IRC | \
SPC5_ME_MC_IRCON | \
SPC5_ME_MC_XOSC0ON | \
SPC5_ME_MC_PLL0ON | \
SPC5_ME_MC_PLL1ON | \
SPC5_ME_MC_FLAON_NORMAL | \
SPC5_ME_MC_MVRON)
#endif


In the first step, I changed the SPC5_ME_MC_IRCON to SPC5_ME_MC_XOSC which worked. Looking at the ME_GS register with the debugger shows me, that the S_SYSCLK has the value 0b0010 for XOSC. But when I am trying to use the FMPLL, this register still shows me that the controller uses the internal RC. How can I activate and use the FMPLL as system clock?

Next question is, that I had to comment the while loop within this function in the file hal_lld.c:

bool_t halSPCSetRunMode(spc5_runmode_t mode) {

/* Clearing status register bits I_IMODE(4) and I_IMTC(1).*/
ME.IS.R = 5;

/* Starts a transition process.*/
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY;
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY_INV;
return OSAL_SUCCESS;
}
/* Waits for the mode switch or an error condition.*/
/* while (TRUE) {
uint32_t r = ME.IS.R;
if (r & 1)
return OSAL_SUCCESS;
if (r & 4)
return OSAL_FAILED;
}*/


The reason was, that I have a self designed controller board with the SPC56EL60. I tried the same software as already worked on the discovery board, but it did not work. It seems, that the mode switch is never completed, because the controller stays in this while loop forever. After uncommenting the while loop, I am now able to run the program with either the internal RC or the external oscillator (40Mhz, as on the discovery board). What could be the reason for that?

Hope somebody can help me or give me a good hint how to find the answers to my questions.

Best regards,
Patrik

Outcomes