Hi,
In SDK5.4, I can't find deinit API for MCAN driver. If customer needs to close MCAN driver, would you pls kindly advise the right sequence?
Use case: using MCAN in SBL and need to close it in SBL and reinit in APP.
Thanks,
Chris
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
In SDK5.4, I can't find deinit API for MCAN driver. If customer needs to close MCAN driver, would you pls kindly advise the right sequence?
Use case: using MCAN in SBL and need to close it in SBL and reinit in APP.
Thanks,
Chris
Hey Chris,
This will depend on what you define as "de-initialized" for CAN, but I would interpret this as powering down the CAN transceiver. You would need to initiate a clock stop request using MCAN_addClockStopRequest to set the CCCR.CSR field to 1. The CAN transceiver should wait for any pending transfer requests, then CCCR.INIT should be set to 1 by the transceiver, and finally CCCR.CSA (Clock Stop Acknowledge) should be set to 1 by the transceiver. You can get the status of the CCCR.CSA field by calling MCAN_getClkStopAck which will return either 0 - no clock stop acknowledged - or 1 - clock stop acknowledged. From here, the clocks to the CAN transceiver can be disabled using the following code:
PRCMPeripheralClkEnable(Power_module.dbRecords[0], PRCM_GATE_CLK_DISABLE);
CSL_REG32_FINS((CSL_APP_RCM_U_BASE + CSL_APP_RCM_IPCFGCLKGATE1), APP_RCM_IPCFGCLKGATE1_IPCFGCLKGATE1_APP_CAN, PRCM_GATE_CLK_DISABLE);
Most of these steps are outlined in Section 12.4.4.8 Power Down (Sleep) Mode of the xWRLx432 Technical Reference Manual which also includes steps on powering up the device - essentially just repeat the disable steps in reverse and using enable macros instead for the clocks.
Hopefully this gives you a rough idea of how to approach this, but let me know if there's anything you need clarified.
Regards,
Kristien