1.We are using 26MHz cryatal instead of 32MHz,and we make the following modification:
1)Modify codes according to the instructions below:
2)Change MCG mode to FBE mode;
const mcg_config_t mcgConfig_BOARD_BootClockRun =
{
.mcgMode = kMCG_ModeFBE,
.irclkEnableMode = kMCG_IrclkEnable,
.ircs = kMCG_IrcSlow,
.fcrdiv = 0x0U,
.frdiv = 0x5U,
.drs = kMCG_DrsMid,
.dmx32 = kMCG_Dmx32Fine,
.oscsel = kMCG_OscselOsc,
}
CLOCK_SetExternalRefClkConfig(mcgConfig_BOARD_BootClockRUN. oscsel);
CLOCK_SetFbeMode(mcgConfig_BOARD_BootClockRUN.frdiv,
mcgConfig_BOARD_BootClockRUN. dmx32,
mcgConfig_BOARD_BootClockRUN. drs,
CLOCK_CONFIG_ FllStableDelay);
3)Modify the codes of FlexCan_Config:
void FlexCan_Config(void)
{
flexcan_config_t flexcanConfig;
FLEXCAN_GetDe faultConfig(&flexcanConfig);
flexcanConfig.clksrc=kFLEXCAN_ ClkSrcOsc;
flexcanConfig .baudRate = 125000;
flexcanConfig .enableIndividMask = true; NULL);
flexcanConfig .maxMbNum = 32;
flexcanConfig .timingConfig .phaseSeg1 = 4;
flexcanConfig .timingConfig .phaseSeg2 = 3;
flexcanConfig .timingConfig.propSeg = 2
FLEXCAN_Init (CAN0Channel, &flexcanConfig, CAN_CLK_FREQ);
FLEXCAN_TransferCreateHandle(CAN0Channel, & flexcanHandle, FlexCan_Callback, NULL);
}
Is there any code in other places that needs to be modified?
2.When KW36 works in FEI mode, after debugging, it enters Deepsleep mode 3 after executing the following codes:
#define cPWR_UsePowerDownMode 1
#define cPWR_DeepSleepMode 3
RSIM->CONTROL = RSIM_CONTROL_MODIFY_FEILD(RSIM_CONTROL_RF_OSC_EN, 0);
the external crystal can be stopped normally.
When the clock is working in FBE mode as modified above, after performing the same operations, the external crystal is still working, that is, the external crystal is not turned off. How can I turn off the external crystal when entering Deepsleep mode 3 in FBE mode?Is there any code in other places that needs to be modified?
Thanks for you reply.
The CAN function is normal after we modify our code mentioned above.Do we have to use SET_CAN_QUANTUM?Couldn't find it in the FRDM demo code,how can we find it and how to use it?
Besides,could you reply to our other questions?
Thanks!
Hello @Shane1,
In the following table explains the low power modes and which wake-up sources are enabled:
The following explains the behavior of the RF oscillator depending of the mode:
Best Regards,
Alexis Andalon
Hello @Shane1,
The capabilities to calculate the baudrate by the FLEXCAN_Init function are a little limited so I in the flexcan examples from the SDK there's an option to enable the input of registers need it to calculate the baudrate manually. Those are enabled with the define SET_CAN_QUANTUM. I would suggest enable this and calculate the values manually.
Best Regards,
Alexis Andalon