Supporter Hello. I use an external crystal oscillator. When I need to enter VLPR mode, do I need to switch the external crystal oscillator to the internal system clock?
Yes.
You can refer the answer in: VLPR, FlexCAN
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi,Robin_Shen,I USE SDK to Change Flexcan PE Clock,My Flexcan clock uses an external crystal oscillator.
When I enter VLPR mode, I need to switch the PE clock to the system clock. Which interface function should I call?
I Re-initialize, switch the PE clock to the peripheral clock, and set the baud rate to 250K。
Below is my code
const flexcan_user_config_t canCom1_InitConfig1 = {
.fd_enable = false,
.pe_clock = FLEXCAN_CLK_SOURCE_PERIPH,
.max_num_mb = 16,
.num_id_filters = FLEXCAN_RX_FIFO_ID_FILTERS_8,
.is_rx_fifo_needed = true,
.flexcanMode = FLEXCAN_NORMAL_MODE,
.payload = FLEXCAN_PAYLOAD_SIZE_8,
.bitrate = {
.propSeg = 2,
.phaseSeg1 = 1,
.phaseSeg2 = 1,
.preDivider = 1,
.rJumpwidth = 1
},
.bitrate_cbt = {
.propSeg = 2,
.phaseSeg1 = 1,
.phaseSeg2 = 1,
.preDivider = 1,
.rJumpwidth = 1
},
.transfer_type = FLEXCAN_RXFIFO_USING_INTERRUPTS,
.rxFifoDMAChannel = 0U
};
void DriverCANIfLowpower_Init(void)
{
uint8_t i = 0;
for(i = 0U; i < RX_FIFO_FILTERS_NUMBER; i++)
{
Can_fifo_filter_table[i].isRemoteFrame = FALSE;
Can_fifo_filter_table[i].isExtendedFrame = true;
Can_fifo_filter_table[i].id = RxFitersIdTable[i].RxId;
}
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig1);
FLEXCAN_DRV_InstallEventCallback(INST_CANCOM1, DriverCANFunc_Callback, NULL);
FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM1, FLEXCAN_RX_FIFO_ID_FORMAT_A, Can_fifo_filter_table);
FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1,FLEXCAN_RX_MASK_INDIVIDUAL);
for(i = 0U; i < (RX_FIFO_FILTERS_NUMBER); i++)
{
FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1, FLEXCAN_MSG_ID_EXT,RxFitersIdTable[i].Index,RxFitersIdTable[i].RxFiterMask);
}
FLEXCAN_DRV_RxFifo(INST_CANCOM1, &gCanRxMsgBuf);
}